How to create a search filter for a three-dimensional string?

-2

I have ArrayList of type String Three-dimensional:

String[][]

And I would like to do a search system that filters the values, eg:

String[][] table = {{"Ronaldo","32","Atacante","Sao Paulo"},
                    {"Cristiano","25","Meio Campo","Curitiba"},
                    {"Marcos","27","Goleiro","Ponte Preta"};

Well, we assume you have a search page with the fields "Name", "Age", "Position in Field" and "Playing Time", you will only fill in the fields Age and Position and would like to do a research system that presents all the results that contain the respective parameters, is it possible?

    
asked by anonymous 03.02.2015 / 20:02

1 answer

0

Jeiferson, we call this matrix. A vector of vectors. Three-dimensional would be String [] [] [].

But, by answering your question, yes is possible. All you have to do is go through the matrix to find what you need. I suggest you use some search method like Binary Search, this will optimize your search.

However, I think the correct question would be: "Is this the best data structure to do this?"

I do not know what the source of this data is, but if it came from a database, consider using some framework of ORM . I suggest Hibernate .

    
03.02.2015 / 21:06