List of usage examples for java.util LinkedList offerFirst
public boolean offerFirst(E e)
From source file:uk.ac.ebi.ep.base.search.EnzymeFinder.java
private List<UniprotEntry> computeUniqueEnzymes(List<UniprotEntry> enzymes, String keyword) { LinkedList<UniprotEntry> enzymeList = new LinkedList<>(); LinkedList<UniprotEntry> theEnzymes = new LinkedList<>(); //Deque<UniprotEntry> enzymeList = new LinkedList<>(); Set<String> proteinNames = new HashSet<>(); for (UniprotEntry entry : enzymes) { if (!proteinNames.contains(entry.getProteinName())) { String enzymeName = HtmlUtility.cleanText(entry.getProteinName()).toLowerCase(); if (enzymeName.toLowerCase().matches(".*" + keyword.toLowerCase() + ".*") && entry.getEntryType() != 1) { enzymeList.offerFirst(entry); } else { enzymeList.offerLast(entry); }//from w w w .ja v a 2 s .c o m } proteinNames.add(entry.getProteinName()); computeFilterFacets(entry); } for (UniprotEntry enzyme : enzymeList) { if (HtmlUtility.cleanText(enzyme.getProteinName()).toLowerCase().equalsIgnoreCase(keyword.toLowerCase()) && enzyme.getEntryType() != 1) { LOGGER.info("FOUND A MATCH " + enzyme.getProteinName() + " => " + keyword + " entry type " + enzyme.getEntryType()); theEnzymes.offerFirst(enzyme); } else { theEnzymes.offerLast(enzyme); } } return theEnzymes.stream().distinct().collect(Collectors.toList()); }