Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Lists - removing with iterator

List<String> names = new ArrayList<>(List.of("John Doe", "Jack Doe", "John Smith"));
Iterator<String> it = names.iterator();
while (it.hasNext()) {
    String name = it.next();
    if (name.startsWith("John")) {
        it.remove();
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: java get difference days without weekends 
Java :: comparable interface 
Java :: check if object is a string java 
Java :: += operator casting in java 
Java :: first method in jdbc 
Java :: open bottomsheet from adapter java 
Java :: remove duplicate string collection in java 
Java :: spring core xml configuration for collection using constructor 
Java :: Program to read base and power and then calculate result of that expression using recursion in java 
Java :: java data table source tymeLeaf 
Java :: fill a 2d array java 
Java :: java.awt.datatransfer.clipboard example 
Java :: java intercambiar la posicion de valores de un array 
Java :: popcat 
Java :: what is serialization and deserialization in rest assured 
Java :: Second Activity not opening problem 
Java :: java fx custom cell factory for combo box 
Java :: java cannot resolve the list method 
Java :: reponse entity as result spring controller 
Java :: docker how to pass params to spring boot application 
Java :: how to easy get 240 fps in minecraft java 
Java :: Reason: Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread context classloader 
Java :: viewResolver 
Java :: java nested for loop 
Java :: java recursion 
Java :: java character in string 
Java :: java final method 
Java :: compare two strings java 
Java :: maven set repository location command line 
Java :: Mila Kunis 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =