You can create a map that maps an identifier to a collection of values;
Map:
1 => { AAA, ABC }
2 => { dasd, dsfdsf, dsfsd }
...
This will have an effective search time of O (1). You can also perform a binary search, but the search will be less efficient.
:
(arraylist, ..). . , , id. , id. .
:
List Index, Object
0 Id=1 Value=A
1 Id=2 Value=B
2 Id=2 Value=C
3 Id=3 Value=D
4 Id=3 Value=E
2. 1: Id = 2, , 0: Id = 1, , , . 3: Id = 3, . .