Example usage for java.util Arrays asList

List of usage examples for java.util Arrays asList

Introduction

In this page you can find the example usage for java.util Arrays asList.

Prototype

@SafeVarargs
@SuppressWarnings("varargs")
public static <T> List<T> asList(T... a) 

Source Link

Document

Returns a fixed-size list backed by the specified array.

Usage

From source file:Main.java

public static void main(String[] a) {
    List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    System.out.println(list.indexOf("A"));
}

From source file:Main.java

public static void main(String[] a) {
    List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    System.out.println(list.size());
    System.out.println(list.isEmpty());
}

From source file:Main.java

public static void main(String[] a) {
    List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    List list1 = Arrays.asList(new String[] { "A", "B", "C", "D" });
    System.out.println(list1.containsAll(list));
}

From source file:Main.java

public static void main(String[] a) {
    List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    System.out.println(list.size());
    System.out.println(list.hashCode());
}

From source file:MainClass.java

public static void main(String[] a) {
    List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    System.out.println(list.lastIndexOf("A"));
}

From source file:MainClass.java

public static void main(String[] a) {
    List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    System.out.println(list.contains("C"));
}

From source file:MainClass.java

public static void main(String[] a) {
    List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    List list2 = Arrays.asList(new String[] { "B", "A" });
    System.out.println(list.contains(list2));
}

From source file:MainClass.java

public static void main(String[] a) {
    List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    list.set(2, "X");
    System.out.println(list);/*  w  w w .j  a  v a2s .c  o  m*/
}

From source file:Main.java

public static void main(String[] a) {
    List<String> list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    list.set(2, "X");
    System.out.println(list);// w  ww .  j a v a 2  s .com
}

From source file:MainClass.java

public static void main(String[] a) {

    List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
    List list2 = Arrays.asList(new String[] { "A", "B", "C" });

    System.out.println(list.equals(list2));
}