java.util.Collections.singletonMap() 方法


java.util.Collections.singletonMap() 方法

package com.codingdict;

import java.util.*;

public class CollectionsDemo {
   public static void main(String[] a) {

      // create singleton map
      Map map = Collections.singletonMap("key","Value");

      System.out.println("Singleton map is: "+map);
   }
}