Vector contains - 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 contains method.

This code example shows how to use the following methods:add, contains, remove, trimToSize
  * Ensure order is changed 
  * 
  */ 
  public void setLastIndex(Object anObject)
  { 
    if(order.contains(anObject))
    { 
      order.remove(anObject);
      order.trimToSize();
      order.add(anObject);
    } 
  } 
     
   
  /** 
  * 
  * Determine if a return page is stored 
  * @return 	true if a return page available 
  * 
  */ 
7
CodeRank
This code example shows how to use the following methods:add, contains
	public static void addFile(File f) throws IOException {
		addURL(f.toURI().toURL());
	} 
 
	public static void addURL(URL u) throws IOException {
		if (added.contains(u)) return;
		added.add(u);
		URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
		Class<?> sysclass = URLClassLoader.class;
		try { 
			Method method = sysclass.getDeclaredMethod("addURL", parameters);
			method.setAccessible(true);
			method.invoke(sysloader, new Object[] { u });
		} catch (Throwable t) {
			throw new IOException("Error, could not add URL to system classloader");
		} 
	} 
} 
7
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:push, contains
         *      java.lang.String, boolean) 
         */ 
        public void register(String sessionID, String participant, boolean postBinding) {
            Stack<String> stack = sessionParticipantsMap.get(sessionID);
            if (stack == null) {
                stack = new Stack<String>();
                sessionParticipantsMap.put(sessionID, stack);
            } 
            if (stack.contains(participant) == false) {
                stack.push(participant);
                postBindingMap.put(participant, Boolean.valueOf(postBinding));
            } 
        } 
 
        /** 
         * @see org.picketlink.identity.federation.web.core.IdentityParticipantStack#getParticipants(java.lang.String) 
         */ 
        public int getParticipants(String sessionID) {
            Stack<String> stack = sessionParticipantsMap.get(sessionID);
            if (stack != null)
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:addElement, contains
	 
	/** 
	 * adds a TreeModelListener 
	 */ 
	public void addTreeModelListener(TreeModelListener l) {
		if (!fModelListeners.contains(l))
			fModelListeners.addElement(l);
	} 
	/** 
	 * Removes a TestModelListener 
	 */ 
	public void removeTreeModelListener(TreeModelListener l) {
		fModelListeners.removeElement(l);
	} 
	/** 
	 * Finds the path to a test. Returns the index of the test in its 
	 * parent test suite. 
	 */ 
	public int findTest(Test target, Test node, Vector path) {
		if (target.equals(node)) 
6
CodeRank
This code example shows how to use the following methods:add, contains, remove
		return _names.elements();
	} 
 
	@Override 
	public Object put(Object key, Object value) { 
		if (_names.contains(key)) {
			_names.remove(key);
		} 
 
		_names.add((String)key);
 
		return super.put(key, value); 
	} 
 
	@Override 
	public Object remove(Object key) { 
		_names.remove(key);
 
		return super.remove(key); 
	} 
7
CodeRank
This code example shows how to use the following methods:add, contains, removeElementAt, size
      } 
      return _querys.elementAt(_currentPos);
    } 
 
    public void addQuery(final String newQuery) {
        if (_querys.contains(newQuery)) {
            System.out.println("schon drin");
            return; 
        } 
 
        _querys.add(newQuery);
 
        if (_querys.size() > _maxsize) {
            _querys.removeElementAt(0);
        } 
 
        _currentPos = _querys.size() - 1;
    } 
 
    // Get to avoid mashaling 

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, 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

Related Vector contains Questions & Answers:

contains Method Overview
Returns true if this vector contains the specified element.
See Code Examples for other Java 8 Vector Methods: