Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.Map;
import java.util.TreeMap;

import java.util.concurrent.atomic.AtomicReferenceArray;

public class Main {
    private static <T> Map<Integer, T> asMap(AtomicReferenceArray<T> a) {
        Map<Integer, T> map = new TreeMap<Integer, T>();
        for (int i = 0; i < a.length(); i++) {
            T t = a.get(i);
            if (t != null) {
                map.put(i, t);
            }
        }
        return map;
    }
}