OrderEntry (@NotNull Module ownerModule, @NotNull List<? extends OrderEntry> orderEntries) { if (orderEntries.size() < 10) { for (OrderEntry orderEntry : orderEntries) { if (orderEntry.getOwnerModule() == ownerModule) { return orderEntry; } } return null; } int index = Collections.binarySearch(orderEntries, new FakeOrderEntry(ownerModule), RootIndex.BY_OWNER_MODULE); return index < 0 ? null : orderEntries.get(index); }