What is Listiterator and what is it for?

Asked

Viewed 97 times

0

What would be the function of ListIterator? I have a variable of type List, that receives the information from my Postgresql Database, I need to access the information of this type variable List but when using the method get() To select the information of a given Index I am having as return the reference of this record and not its information. With the listIterator I can access the information of my variable of type List?

def i = 0;
def x = 0;
def z = transportadorasBanco.size();
def y = listaTransportadoras.size();
logger.info("Registros BDM: "+ z)
logger.info("Registros Banco de Dados PostgreSQL: "+ y)

def itemBDM = []
def itemPost = []

while (x <= (z - 1)){
    while (i <= (y - 1)){
        if (transportadorasBanco.get(x).toString().equals(listaTransportadoras.get(i).toString())){
            logger.info("POSSICAO BDM: " +x)
            logger.info("POSSICAO POSTGRESQL: " +i)
            logger.info("IGUAIS")
            logger.info(transportadorasBanco.get(x).toString())
            logger.info(listaTransportadoras.get(i).toString())
            logger.info("")
        }
        else {
            logger.info("POSSICAO BDM: " +x)
            logger.info("POSSICAO POSTGRESQL: " +i)
            logger.info("DIFERENTES")
            logger.info(transportadorasBanco.get(x).toString())
            logger.info(listaTransportadoras.get(i).toString())
            logger.info("")
        }
        i++;
    }
    x++;
    i = 0;
}
  • This one of yours List is integer?

  • Has the integer numbers and strings

  • You can give a code example of your method get not returning the information you want?

  • I edited my question, with the script in groovy where I try to access the variable information

  • The lists transportadorasBanco and listaTransportadoras are lists of which?

  • I am programming in a program to develop BPM to develop processes, in this tool has the BDM (Business Data Model), a business database, then the variable transportadorasBanco receives BDM values and variable listaTransportadoras receives the information from Postgresql

  • But you could tell me at least the function of ListIterator?

  • A ListIterator is a Iterator list-specific. In addition to the methods he inherits from a Iterator, it has methods that allow you to scroll through the list in both directions and modify the list during iteration.

  • And I get through ListIterator compare information from my list, for example take out the repeated codes?

Show 5 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.