Java Array Invert invert(int[][] clustered)

Here you can find the source of invert(int[][] clustered)

Description

Map index to cluster from cluster array

License

Open Source License

Parameter

Parameter Description
clustered a parameter

Return

index to cluster

Declaration

public static Map<Integer, Integer> invert(int[][] clustered) 

Method Source Code


//package com.java2s;
import java.util.HashMap;
import java.util.Map;

public class Main {
    /**/*from ww  w.  java2s .  c  o  m*/
     * Map index to cluster from cluster array
     * @param clustered
     * @return index to cluster
     */
    public static Map<Integer, Integer> invert(int[][] clustered) {
        int cluster = 0;
        Map<Integer, Integer> ret = new HashMap<Integer, Integer>();
        for (int[] is : clustered) {
            for (int index : is) {
                ret.put(index, cluster);
            }
            cluster++;
        }
        return ret;
    }
}

Related

  1. invert(double[] ary)
  2. invert(float[] a)
  3. invert(float[] m, float[] invOut)
  4. invert(int[] bits)
  5. invert(int[] v)
  6. invert(Object[] array)
  7. invert(Object[] objArray)
  8. invert(T[] array)
  9. invert3x3(float m[], float inv[])