List<LookupElement> () { ThreadingAssertions.assertEventDispatchThread(); var itemsCount = myList.getItemsCount(); if (!myShown || itemsCount == 0) return Collections.emptyList(); synchronized (myUiLock) { int lowerItemIndex = myList.getFirstVisibleIndex(); int higherItemIndex = myList.getLastVisibleIndex(); if (lowerItemIndex < 0 || higherItemIndex < 0) return Collections.emptyList(); return getListModel().toList().subList(lowerItemIndex, Math.min(higherItemIndex + 1, itemsCount)); } }