Vector indexOf - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Vector indexOf method.

This code example shows how to use the following methods:indexOf, removeElement, size
 
    public void closeFrame(final JInternalFrame f) {
        if (f == fCurrentFrame) {
            activateNextFrame(); 
        } 
        fChildFrames.removeElement(f);
        super.closeFrame(f);
    } 
 
    public void deiconifyFrame(final JInternalFrame f) {
        JInternalFrame.JDesktopIcon desktopIcon;
 
        desktopIcon = f.getDesktopIcon();
        // If the icon moved, move the frame to that spot before expanding it 
        // reshape does delta checks for us 
        f.reshape(desktopIcon.getX(), desktopIcon.getY(), f.getWidth(), f.getHeight());
        super.deiconifyFrame(f);
    } 
 
    void addIcon(final Container c, final JInternalFrame.JDesktopIcon desktopIcon) {

6
CodeRank
This code example shows how to use the following methods:elementAt, indexOf, removeElement, size
 
    public void closeFrame(final JInternalFrame f) {
        if (f == fCurrentFrame) {
            activateNextFrame(); 
        } 
        fChildFrames.removeElement(f);
        super.closeFrame(f);
    } 
 
    public void deiconifyFrame(final JInternalFrame f) {
        JInternalFrame.JDesktopIcon desktopIcon;
 
        desktopIcon = f.getDesktopIcon();
        // If the icon moved, move the frame to that spot before expanding it 
        // reshape does delta checks for us 
        f.reshape(desktopIcon.getX(), desktopIcon.getY(), f.getWidth(), f.getHeight());
        super.deiconifyFrame(f);
    } 
 
    void addIcon(final Container c, final JInternalFrame.JDesktopIcon desktopIcon) {

6
CodeRank
This code example shows how to use the following methods:contains, indexOf, remove, setElementAt
        } 
        return null; 
    } 
 
    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
        if (mChildNodes.contains(oldChild)) {
            // Try to remove the new child if available 
            try { 
                mChildNodes.remove(newChild);
            } catch (DOMException e) {
                // Ignore exception 
            } 
            mChildNodes.setElementAt(newChild, mChildNodes.indexOf(oldChild));
            ((NodeImpl)newChild).setParentNode(this);
            ((NodeImpl)oldChild).setParentNode(null);
        } else { 
            throw new DOMException(DOMException.NOT_FOUND_ERR, "Old child does not exist");
        } 
        return oldChild;
    } 
7
CodeRank
This code example shows how to use the following methods:indexOf
	 
	 
	public  boolean filter(String[] values, boolean order_by_source,boolean constrain_by_taxonomy) {
		String column="";
		 
		if(values[column_definition.indexOf("sort_override")].equals("1") && values[column_definition.indexOf("selected")].equals("true")) {
			return true; 
		} 
		 
		if(order_by_source && constrain_by_taxonomy) {
			column="source_constrain_on_order";
		}else if(order_by_source && !constrain_by_taxonomy) {
			column="source_constrain_off_order";
		}else if(!order_by_source && constrain_by_taxonomy) {
			column="highertaxa_score_order";
		}else if(!order_by_source && !constrain_by_taxonomy) {
			column="overall_score_order";
		} 
		 
		 

6
CodeRank
This code example shows how to use the following methods:indexOf
        mObsoletePositions.remove(Integer.valueOf(i));
        return fragment;
    } 
 
    public int getFilePosition(OCFile file) {
        return mImageFiles.indexOf(file);
    } 
     
    @Override 
    public int getCount() { 
        return mImageFiles.size();
    } 
 
    @Override 
    public CharSequence getPageTitle(int position) {
        return mImageFiles.get(position).getFileName();
    } 
 
     
    public void updateFile(int position, OCFile file) {
6
CodeRank
This code example shows how to use the following methods:contains, indexOf, remove
        } 
        return null; 
    } 
 
    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
        if (mChildNodes.contains(oldChild)) {
            // Try to remove the new child if available 
            try { 
                mChildNodes.remove(newChild);
            } catch (DOMException e) {
                // Ignore exception 
            } 
            mChildNodes.setElementAt(newChild, mChildNodes.indexOf(oldChild));
            ((NodeImpl)newChild).setParentNode(this);
            ((NodeImpl)oldChild).setParentNode(null);
        } else { 
            throw new DOMException(DOMException.NOT_FOUND_ERR, "Old child does not exist");
        } 
        return oldChild;
    } 
6
CodeRank
This code example shows how to use the following methods:add, contains, indexOf, remove
   * @param p           the printstream to add 
   * @param timestamp   whether to use timestamps or not 
   * @param prefix      the prefix to use 
   */ 
  public void add(PrintStream p, boolean timestamp, String prefix) {
    if (m_Streams.contains(p))
      remove(p);
 
    // make sure it's not null 
    if (prefix == null)
      prefix = "";
 
    m_Streams.add(p);
    m_Timestamps.add(new Boolean(timestamp));
    m_Prefixes.add(prefix);
  } 
 
  /** 
   * returns the specified PrintStream from the list 
   *  

6
CodeRank
This code example shows how to use the following methods:get, indexOf, size
		this.order.addAll(order); 
	} 
	public Component getComponentAfter(Container focusCycleRoot, 
			Component aComponent) 
	{ 
		int idx = (order.indexOf(aComponent) + 1) % order.size(); 
		return order.get(idx); 
	} 
 
	public Component getComponentBefore(Container focusCycleRoot, 
			Component aComponent) 
	{ 
		int idx = order.indexOf(aComponent) - 1; 
		if (idx < 0) { 
			idx = order.size() - 1; 
		} 
		return order.get(idx); 
	} 
 
	public Component getDefaultComponent(Container focusCycleRoot) { 
6
CodeRank
This code example shows how to use the following methods:add, contains, indexOf, remove
   * @param p           the printstream to add 
   * @param timestamp   whether to use timestamps or not 
   * @param prefix      the prefix to use 
   */ 
  public void add(PrintStream p, boolean timestamp, String prefix) {
    if (m_Streams.contains(p))
      remove(p);
 
    // make sure it's not null 
    if (prefix == null)
      prefix = "";
 
    m_Streams.add(p);
    m_Timestamps.add(new Boolean(timestamp));
    m_Prefixes.add(prefix);
  } 
 
  /** 
   * returns the specified PrintStream from the list. 
   *  

6
CodeRank
This code example shows how to use the following methods:add, indexOf, lastIndexOf, setSize
    // Following should not throw per JRE. 
    assertEquals(-1, v.lastIndexOf("a", -10));
  } 
 
  public void testExceptions() throws Exception {
    Vector<String> v = new Vector<String>();
    v.add("a");
 
    try { 
      v.indexOf("a", -1);
      fail("should have failed"); 
    } catch (IndexOutOfBoundsException expected) {
      // Success. 
    } 
 
    try { 
      v.lastIndexOf("a", 2);
      fail("should have failed"); 
    } catch (IndexOutOfBoundsException expected) {
      // Success. 

7
CodeRank
indexOf Method Overview
Returns the index of the first occurrence of the specified element in this vector, or -1 if this vector does not contain the element.
See Code Examples for other Java 8 Vector Methods: