Java List Create createWidList(int[][] widArray)

Here you can find the source of createWidList(int[][] widArray)

Description

Converts two dimensional integer (representing word ids) array into a list of lists.

License

Open Source License

Parameter

Parameter Description
widArray two dimensional interger array

Return

list of lists.

Declaration

public static List<List<Integer>> createWidList(int[][] widArray) 

Method Source Code


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

import java.util.ArrayList;
import java.util.List;

public class Main {
    /**/*w  w  w  . j a  v a 2s .c  o m*/
     * Converts two dimensional integer (representing word ids) array into a 
     * list of lists. Used for testing purposes.
     * 
     * @param widArray two dimensional interger array
     * @return list of lists.
     */
    public static List<List<Integer>> createWidList(int[][] widArray) {
        List<List<Integer>> widList = new ArrayList<List<Integer>>();
        for (int[] widArrayGroup : widArray) {
            List<Integer> widListGroup = new ArrayList<Integer>();
            for (int wid : widArrayGroup) {
                widListGroup.add(wid);
            }
            widList.add(widListGroup);
        }
        return widList;
    }
}

Related

  1. createUniqueProducts(List list1, List list2)
  2. createUnmodifiableList(Collection coll)
  3. createUpdateMeasurementItemList(final String itemList, final String updateItem)
  4. createValues(int barCount, String valueDigits, int distributionType, List valueCounts)
  5. createWhereInClause(String field, List values, boolean isString)
  6. getOrCreateList(Map> map, K key)