Ok i have list a and list b
Is there any way to check if there is between two?
List a // 1,2,4,5 List B // 1,6,7,8
Between both lists // 1 FAILURE
// 1 FAILURE
Collections.disjoint(list1, list2)
returns trueif they do not have common elements.
true
Use Collections.disjoint.
Collections.disjoint
Returns true if the two specified collections do not have elements in common
boolean hasCommonElements = Collections.disjoint(listA, listB);
Collections.disjoint():
Collections.disjoint()
public static boolean disjoint (Collection c1, Collection c2): true, .
:
List<Integer> a = new ArrayList<Integer>(); List<Integer> b = new ArrayList<Integer>(); System.out.println(Collections.disjoint(a, b));
Collections.disjoint(a, b); : true, .
Collections.disjoint(a, b);
Source: https://habr.com/ru/post/1533412/More articles:iOS: app crashes due to dispatch_queue - iosMoving messages between queues rabbitMQ - messageIs it possible to move / merge messages between RabbitMQ queues? - pythonБудет ли затененная привязка GCed? - garbage-collectionIs there a Python function or method that displays the specifications of an object? - pythonDefining regular expressions with Notepad ++ - regexJava operations with collections - javaDeploy Spring Boot Application for AWS Beanstalk - spring-bootchange navigation box elements inside fragment - androidApplication level design - what is your best practice? - javaAll Articles