Convert array to Set<String>
new HashSet<String>(Arrays.asList(array));
and do
Set<String> commonOnes = biggerSet.retainAll(smallerSet);
biggerSet.removeAll(commonOnes).add(smallerSet.removeAll(commonOnes))
or use guava difference()
More Related Contents:
- JAVA ArrayIndexoutofBoundException issue
- Reading String for list of Integers separated by spaces [duplicate]
- Write a program that takes an array/arraylist of integer and finds longest sub array/arraylist whose entries are equal [closed]
- How to add two int array values together?
- Difference between int[] array and int array[]
- How to split a String by space
- Sort an array in Java
- The best way to print a Java 2D array? [closed]
- Convert integer into byte array (Java)
- NullPointerException when Creating an Array of objects [duplicate]
- How do I copy a 2 Dimensional array in Java?
- What is the Cost of Calling array.length
- How to convert object array to string array in Java
- How to return an array from JNI to Java?
- How to parse JSON Array (Not Json Object) in Android
- How to convert a Java 8 Stream to an Array?
- How can I create a stream from an array?
- How do I fill arrays in Java?
- How to increase an array’s length
- How to access nested elements of json object using getJSONArray method
- Why can I edit the contents of a final array in Java?
- How to manipulate arrays. Find the average. Beginner Java
- How to find the only number in an array that doesn’t occur twice [duplicate]
- Time Complexity for Java ArrayList
- How to deep copy an irregular 2D array
- java: Arrays.sort() with lambda expression
- add an element to int [] array in java [duplicate]
- Finding prime numbers with the Sieve of Eratosthenes (Originally: Is there a better way to prepare this array?)
- How to remove element from an array
- Error of int cannot be dereferenced?