Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java compare lists

List<String> firstList=Arrays.asList("Hello","World");
List<String> secondList=new ArrayList<>(firstList);
System.out.println(firstList.equals(secondList));//true
secondList.add("other element");
System.out.println(firstList.equals(secondList));//false
 
PREVIOUS NEXT
Tagged: #java #compare #lists
ADD COMMENT
Topic
Name
7+3 =