int (OrderEntry @NotNull [] entries, @NotNull Library library) { for (int i = 0; i < entries.length; i++) { OrderEntry entry = entries[i]; if (entry instanceof LibraryOrderEntry && library.equals(((LibraryOrderEntry)entry).getLibrary())) { return i; } } return -1; }