I have a list of objects and I have a list of strings.
List<String> states = new List<String>();
states.add("wisconsin");
states.add("Florida");
states.add("new york");
List<Foo> foo = new List<Foo>();
foo.add(new Foo(2000, name1, "wisconsin"));
foo.add(new Foo(1000, name2, "california"));
foo.add(new Foo(300, name3, "Florida"));
An object has three properties: int age, row name, and row state.
and I added these objects to the list. The second list consists of a line of "states".
How can I compare these two lists? What is the best way to do this? I want to know if one of the objects has the same “state” that the other list consists of. Please guide me.
source
share