Example usage for java.util Vector containsAll

List of usage examples for java.util Vector containsAll

Introduction

In this page you can find the example usage for java.util Vector containsAll.

Prototype

public synchronized boolean containsAll(Collection<?> c) 

Source Link

Document

Returns true if this Vector contains all of the elements in the specified Collection.

Usage

From source file:MainClass.java

public static void main(String args[]) {
    Vector v = new Vector();
    v.add("A");//from  ww w  .  j  a va  2  s .c  om
    v.add("B");

    Vector v2 = new Vector();
    v2.add("A");
    v2.add("B");
    v2.add("C");

    boolean isContaining = v2.containsAll(v);

    System.out.println(isContaining);
}

From source file:Main.java

public static void main(String args[]) {
    Vector<String> v = new Vector<String>();
    v.add("A");//from ww w  . j  a  v a  2s. co m
    v.add("B");

    Vector<String> v2 = new Vector<String>();
    v2.add("A");
    v2.add("B");
    v2.add("C");

    boolean isContaining = v2.containsAll(v);

    System.out.println(isContaining);
}

From source file:Main.java

public static void main(String[] args) {
    Vector<Integer> vec = new Vector<Integer>(4);
    Vector<Integer> vectest = new Vector<Integer>(4);
    Vector<Integer> vecdiff = new Vector<Integer>(4);

    vec.add(4);/*from w  w  w. j  av  a2 s.c  o  m*/
    vec.add(3);
    vec.add(2);

    vectest.add(4);
    vectest.add(3);
    vectest.add(2);

    vecdiff.add(4);
    vecdiff.add(3);
    vecdiff.add(12);

    // let us check vec and vectest
    System.out.println(vectest.containsAll(vec));

    // let us check vec and vecdiff
    System.out.println(vecdiff.containsAll(vec));
}

From source file:edu.ku.brc.specify.tasks.subpane.wb.wbuploader.Uploader.java

/**
 * @param solutions//from   ww w  .j av a2 s .co  m
 * @return a copy of solutions with only duplicate solutions (i.e same tables, different order) removed.
 */
protected Vector<Vector<Table>> removeDuplicateSolutions(Vector<Vector<Table>> solutions) {
    SortedSet<Vector<Table>> sorted = new TreeSet<Vector<Table>>(new Comparator<Vector<Table>>() {
        /*
         * (non-Javadoc)
         * 
         * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
         */
        public int compare(Vector<Table> o1, Vector<Table> o2) {
            int size1 = o1 == null ? 0 : o1.size();
            int size2 = o2 == null ? 0 : o2.size();
            if (o1 != null && o2 != null && size1 == size2) {
                if (o1.containsAll(o2)) {
                    return 0;
                }
                // else
                if (o1.size() == 0)
                    return 0;
                int id1 = o1.get(0).getTableInfo().getTableId();
                int id2 = o2.get(0).getTableInfo().getTableId();
                return id1 < id2 ? -1 : (id1 == id2 ? 0 : 1);
            }
            return size1 < size2 ? -1 : 1;

        }
    });
    for (Vector<Table> solution : solutions) {
        sorted.add(solution);
    }
    Vector<Vector<Table>> result = new Vector<Vector<Table>>();
    result.addAll(sorted);
    return result;
}