List of usage examples for java.util Vector lastIndexOf
public synchronized int lastIndexOf(Object o)
From source file:MainClass.java
public static void main(String args[]) { Vector v = new Vector(); for (int i = 0, n = members.length; i < n; i++) { v.add(members[i]);// w w w.j a va 2 s.c o m } System.out.println(v); System.out.println(v.lastIndexOf("I")); }
From source file:Main.java
public static void main(String[] args) { Vector vec = new Vector(6); vec.add(4);/*from ww w. j a v a 2s . c o m*/ vec.add(3); vec.add(2); vec.add(1); vec.add(2); vec.add(1); // let us print the last index of 1 System.out.println("last index :" + vec.lastIndexOf(1)); }
From source file:Main.java
public static void main(String[] args) { Vector<String> v = new Vector<String>(); v.add("1");//from www .ja v a2 s. c o m v.add("2"); v.add("3"); v.add("4"); v.add("5"); v.add("1"); v.add("2"); System.out.println(v.contains("3")); System.out.println(v.indexOf("5")); System.out.println(v.lastIndexOf("2")); }
From source file:MainClass.java
public static void main(String args[]) { Vector v = new Vector(); for (int i = 0, n = members.length; i < n; i++) { v.add(members[i]);/*from w ww .j av a 2 s. c o m*/ } System.out.println(v); System.out.println("Contains A?: " + v.contains("A")); System.out.println("Where's A?: " + v.indexOf("A")); System.out.println("Where's B from end?: " + v.lastIndexOf("B")); int index = 0; int length = v.size(); while ((index < length) && (index >= 0)) { index = v.indexOf("C", index); if (index != -1) { System.out.println(v.get(index)); index++; } } }
From source file:FindVector.java
public static void main(String args[]) { String data[] = { "Java", "Source", "and", "Support", "." }; Vector v = new Vector(); for (int i = 0, n = data.length; i < n; i++) { v.add(data[i]);//ww w. ja va 2s. c om } System.out.println(v); System.out.println("Contains Java?: " + v.contains("Java")); System.out.println("Contains Java2s?: " + v.contains("Java2s")); System.out.println("Where's and?: " + v.indexOf("and")); System.out.println("Where's Source?: " + v.indexOf("Source")); System.out.println("Where's Java from end?: " + v.lastIndexOf("Java")); }
From source file:FindVector2.java
public static void main(String args[]) { Vector v = new Vector(); for (int i = 0, n = members.length; i < n; i++) { v.add(members[i]);//from w w w . ja v a 2s . c om } System.out.println(v); System.out.println("Contains Society?: " + v.contains("Society")); System.out.println("Contains Waldo?: " + v.contains("Waldo")); System.out.println("Where's Waldo?: " + v.indexOf("Waldo")); System.out.println("Where's Thoreau?: " + v.indexOf("Thoreau")); System.out.println("Where's Thoreau from end?: " + v.lastIndexOf("Thoreau")); int index = 0; int length = v.size(); while ((index < length) && (index >= 0)) { index = v.indexOf("Thoreau", index); if (index != -1) { System.out.println(v.get(index)); index++; } } }