Collections.emptySortedMap() in Java

Collections.emptySortedMap(): This method is available in java.util.Collections class of Java.

Syntax:

<Object, Object> SortedMap<Object, Object>  java.util.Collections.emptySortedMap()

This method returns an empty sorted map.

Note: This map is serializable.

Parameters: NA

Returns: an empty sorted map.

Exceptions: NA

Approach

Java

import java.util.Collections;

public class CollectionsemptySortedMap {
    public static void main(String[] args) {

        System.out.println(Collections.emptySortedMap());

    }
}

Output:

{}


No comments:

Post a Comment