vendredi 9 juin 2017

ArrayList remove except if contains character

How can I remove all entries from an ArrayList except the ones that contain certain characters independently from upper and lower case?

String[] numbers = new String[] {"One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve"};

ArrayList arrayList=new ArrayList<>(Arrays.asList(numbers));


ArrayList.remove();

E.g. if I choose the letters "Ne" I would like to remove all the entries from the arraylist except the entries containing the charachter string "ne".

Aucun commentaire:

Enregistrer un commentaire