Java Code Examples for java.util.LinkedList#sort()

The following examples show how to use java.util.LinkedList#sort() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FastTransferManager.java    From NotEnoughItems with MIT License 6 votes vote down vote up
private void generateSlotMap(Container container, ItemStack stack) {
    stack = stack.copy();
    stack.setCount(1);

    for (int slotNo = 0; slotNo < container.inventorySlots.size(); slotNo++) {
        if (slotZoneMap.containsKey(slotNo) || !container.getSlot(slotNo).isItemValid(stack)) {
            continue;
        }

        HashSet<Integer> connectedSlots = new HashSet<>();
        findConnectedSlots(container, slotNo, connectedSlots);

        LinkedList<Integer> zoneSlots = new LinkedList<>(connectedSlots);
        zoneSlots.sort(new SlotPositionComparator(container));
        slotZones.add(zoneSlots);

        for (int i : zoneSlots) {
            slotZoneMap.put(i, slotZones.size() - 1);
        }
    }
}
 
Example 2
Source File: VolatileDNALog.java    From narjillos with MIT License 4 votes vote down vote up
@Override
public List<DNA> getAllDna() {
	LinkedList<DNA> result = new LinkedList<>(idToDna.values());
	result.sort((dna1, dna2) -> (int) (dna1.getId() - dna2.getId()));
	return result;
}
 
Example 3
Source File: EmxExportServiceImpl.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
private LinkedList<EntityType> sortEntityTypesAbstractFirst(Collection<EntityType> entityTypes) {
  LinkedList<EntityType> sortedEntityTypes = Lists.newLinkedList(entityTypes);
  sortedEntityTypes.sort(Comparator.comparing(EntityType::isAbstract).reversed());
  return sortedEntityTypes;
}