List of usage examples for java.util Arrays asList
@SafeVarargs @SuppressWarnings("varargs") public static <T> List<T> asList(T... a)
From source file:Iterate.java
public static void main(String args[]) { String elements[] = { "Irish Setter", "Poodle", "English Setter", "Gordon Setter", "Pug" }; Set set = new HashSet(Arrays.asList(elements)); Iterator iter = set.iterator(); while (iter.hasNext()) { System.out.println(iter.next()); }/* www. ja v a 2 s . c o m*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { String[] array = new String[] { "a", "b", "c" }; Collections.shuffle(Arrays.asList(array)); }
From source file:MainClass.java
public static void main(String[] args) { String input = "This!!unusual use!!of exclamation!!points"; System.out.println(Arrays.asList(Pattern.compile("!!").split(input))); System.out.println(Arrays.asList(Pattern.compile("!!").split(input, 3))); System.out.println(Arrays.asList("Aha! String has a split() built in!".split(" "))); }
From source file:MainClass.java
public static void main(String args[]) { String[] a = new String[] { "a", "b", "c" }; List list = Arrays.asList(a); Iterator i = list.iterator(); while (i.hasNext()) { System.out.println(i.next()); }//from w ww.j a v a 2 s .co m }
From source file:Main.java
public static void main(String[] args) { Integer[] numbers = { 8, 2, 6, 7, 0, 1, 4, 9, 5, 3 }; int min = (int) Collections.min(Arrays.asList(numbers)); int max = (int) Collections.max(Arrays.asList(numbers)); System.out.println("Min number: " + min); System.out.println("Max number: " + max); }
From source file:MainClass.java
public static void main(String[] a) { String elements[] = { "A", "B", "C", "D", "E" }; Set set = new HashSet(Arrays.asList(elements)); System.out.println(set.isEmpty()); }
From source file:MainClass.java
public static void main(String[] a) { String elements[] = { "A", "B", "C", "D", "E" }; Set set = new HashSet(Arrays.asList(elements)); System.out.println(set.contains("A")); }
From source file:MainClass.java
public static void main(String[] a) { String elements[] = { "A", "B", "C", "D", "E" }; Set set = new HashSet(Arrays.asList(elements)); System.out.println(set);/*from w w w . j a v a2 s . c om*/ }
From source file:MainClass.java
public static void main(String args[]) throws Exception { String elements[] = { "A", "C", "D", "G", "F" }; TreeSet set = new TreeSet(Arrays.asList(elements)); System.out.println(set.headSet("D")); System.out.println(set.tailSet("")); }
From source file:MainClass.java
public static void main(String[] a) { String elements[] = { "A", "B", "C", "D", "E" }; Set set = new HashSet(Arrays.asList(elements)); Set set2 = ((Set) ((HashSet) set).clone()); System.out.println(set2);// w w w . ja va 2s .c o m }