java - What kind of collection class to get position in array? -
I have the following status and I am seeking a suggestion to "correct" in Java.
I have an Every object Contains two other objects, Now one of my method is a method object Y Gives examples. Now I need an index in How do I do without horrible loops? I can use it instead of A more natural option for the problem to keep your objects in a map, using your Y as a Y and keeping it as an object value: Note that the map stores an A only for each specific value of y. It is not suitable to associate Multiple A with one Y. For this, you will use a set map or something similar. ArrayList which has a list of objects (let's call it A object),
ArrayList , where I get the same thing.
ArrayList
Maps & lt; Y, A & gt; Map = new hashmap & lt; & Gt; (); Void placed (AA) {map.put (a.Y, A); } A getA (y y) {back to map.get (y); }
Comments
Post a Comment