Java List Sort sortLongSeqList(List firstList, List secondList)

Here you can find the source of sortLongSeqList(List firstList, List secondList)

Description

sort Long Seq List

License

Open Source License

Declaration

public static List<Long> sortLongSeqList(List<Long> firstList, List<Long> secondList) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.List;

public class Main {

    public static List<Long> sortLongSeqList(List<Long> firstList, List<Long> secondList) {
        List<Long> entry = new ArrayList<Long>();
        if (firstList != null && firstList.size() > 0) {
            if (secondList != null && secondList.size() > 0) {
                int seq = 0;
                for (int i = 0; i < firstList.size(); i++) {
                    for (int j = 0; j < secondList.size(); j++) {
                        if (secondList.get(j) == firstList.get(i).longValue()) {
                            entry.add(seq, secondList.get(j));
                            seq++;//from   w  w  w . j av a  2  s .  com
                        }
                    }
                }
            }
        }
        return entry;
    }
}

Related

  1. sortListByMapKey(List> list)
  2. sortListEntry(List firstList, List secondList)
  3. sortListOfDoublesAndRemoveDuplicates(List items, double tolerance, double toleranceSmallNumbers)
  4. sortListStingArrayByFirstDes( List list)
  5. sortLocales(final List locales)
  6. sortLoops(ArrayList list)
  7. sortMap(Map targetMap, List sortedList)
  8. sortMapEntryListByValue(List> entries, boolean descending)
  9. sortMessages(List ms)