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

This code example shows how to use the following methods:pop, add
public class StackNotEmptySpec extends StackSpec { 
  @Test 
  @Named("pop removes last element") 
  @Order(1) 
  public void _popRemovesLastElement() throws Exception { 
    Stack<String> _stack = new Stack<String>();
    final Stack<String> stack = _stack;
    stack.add("something");
    String _pop = stack.pop();
    boolean _doubleArrow = Should.<String>operator_doubleArrow(_pop, "something");
    Assert.assertTrue("\nExpected stack.pop => \"something\" but"
     + "\n     stack.pop is " + new org.hamcrest.StringDescription().appendValue(_pop).toString()
     + "\n     stack is " + new org.hamcrest.StringDescription().appendValue(stack).toString() + "\n", _doubleArrow);
     
  } 
} 
8
CodeRank
This code example shows how to use the following methods:add, size
 
            /** 
             * Add a new message to the list and update the View. 
             */ 
            public void add(ConsoleMessage consoleMessage) {
                mMessages.add(consoleMessage);
                notifyDataSetChanged();
            } 
 
            /** 
             * Remove all messages from the list and update the view. 
             */ 
            public void clear() { 
                mMessages.clear();
                notifyDataSetChanged();
            } 
 
            @Override 
            public boolean areAllItemsEnabled() { 
                return false; 

7
CodeRank
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
	} 
 
	public synchronized void returnConn(Connection conn) {
		lock.lock();
		busyConnections.remove(conn);
		idleConnections.add(conn);
		lock.unlock();
	} 
 
	public synchronized void close() throws SQLException { 
		lock.lock();
		for (Connection conn : idleConnections)
			conn.close();
 
		for (Connection conn : busyConnections)
			conn.close();
 
		busyConnections.clear();
		idleConnections.clear();
		lock.unlock();
7
CodeRank
This code example shows how to use the following methods:add, get
package p; 
 
import java.util.Vector; 
 
class TypeParams9<T1 extends Number & Comparable> {
	Comparable f(T1 t1) {
		Vector v1 = new Vector();
		v1.add(t1);
		v1.add(new Integer(1));
		v1.add("");
		return (Comparable) v1.get(0);
	} 
} 
7
CodeRank
This code example shows how to use the following methods:peek, pop, push, add, get
	} 
 
	public void concreteWriteReadStackNegativeTest() { 
		String tainted = TelephonyManager.getDeviceId();
		Stack<String> stack = new Stack<String>();
		Stack<String> stack2 = new Stack<String>();
		stack.addElement("neutral");
		stack2.push(tainted);
		stack2.add(tainted);
		String untaintedElement = stack.get(0);
		String taintedElement = stack2.peek();
		taintedElement = stack2.pop();
		taintedElement = stack2.get(0);
		taintedElement.toString();
 
		ConnectionManager cm = new ConnectionManager();
		cm.publish(untaintedElement);
	} 
 
	public void staticLinkedList() { 
7
CodeRank
This code example shows how to use the following methods:add
	public PatientForm() 
	{ 
		this.add(new StringInput("age")); 
		this.add(new SelectInput("gender", "unknown")); 
		this.add(new StringInput("ethnicity")); 
		Vector<ValueLabel> deceasedOptions = new Vector<ValueLabel>(); 
		deceasedOptions.add(new ValueLabel("deceased", "")); 
		this.add(new CheckboxInput("deceased", "", "Is patient deceased?", deceasedOptions, new Vector<String>())); 
		this.add(new StringInput("death_cause")); 
		this.add(new StringInput("mmp1_allele1")); 
		this.add(new StringInput("mmp1_allele2")); 
		this.add(new SelectInput("consent", "no")); 
		this.add(new StringInput("identifier")); 
		this.add(new SelectInput("mutation1", "")); 
		this.add(new SelectInput("mutation2", "")); 
		this.add(new StringInput("number", "")); 
		this.add(new StringInput("pdf", "")); 
		this.add(new SelectInput("phenotype", "")); 
		this.add(new StringInput("pubmed", "")); 
		this.add(new StringInput("comment", "")); 
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:add, toArray
    @Override 
    public void testSignatures() { 
        Status status = null;
        try { 
            String javaVersion = System.getProperty("java.version");
            Vector args = new Vector();
            // Get the location of the rule execution sets. 
            // Currently we assume we can find the signature file here 
            // as well. 
            String dir = TestCaseUtil.getRuleExecutionSetLocation();
            args.add("-FileName");
            if (javaVersion.startsWith("1.4")) {
                args.add(dir + "/" + "jaxrules14.sig");
            } else if (javaVersion.startsWith("1.5") || javaVersion.startsWith("1.6")) {
                args.add(dir + "/" + "jaxrules.sig");
            } else { 
                args.add(dir + "/" + "jaxrules17.sig");
            } 
 
            args.add("-Package");

7
CodeRank
This code example shows how to use the following methods:add
    public boolean hasStableIds() { 
        return true; 
    } 
 
    public void registerDataSetObserver(DataSetObserver observer) {
        mObservers.add(observer);
    } 
 
    public void unregisterDataSetObserver(DataSetObserver observer) {
        mObservers.remove(observer);
    } 
 
    public void onGroupExpanded(int groupPosition) {
    } 
 
    public void onGroupCollapsed(int groupPosition) {
    } 
 
    public long getCombinedChildId(long groupId, long childId) {
        return childId;
7
CodeRank

Related Vector add Questions & Answers:

add Method Overview
Inserts the specified element at the specified position in this Vector.
See Code Examples for other Java 8 Vector Methods: