Collections.BinarySearch returns the index in the list where the item was found. If you need to return the object then return list.get(index) . Your foreach loop around the search call doesn't make much sense though. For a given path, it's a single call to locate it within the list. Also, sorting the list for each search is unnecessary - just sort it when the list changes (using a sorted set would manage that for you automatically)
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847