[Solved] Using Java 8 lambda and Stream for information extraction


Something like this should do it for you :

    serviceConfigList.stream()
        .filter(ser -> ser.getValid().equals("true"))
        .forEach(ser -> {
            Connection.SERVICE_PORT = ser.getPort();
            Connection.SERVICE_ADDRESS = ser.getIp();
            // other code..
    });

PS : I don’t have your complete code. So can’t help more.

4

solved Using Java 8 lambda and Stream for information extraction