All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.owasp.shim.ForJava9AndLater Maven / Gradle / Ivy

Go to download

Provides an implementation of java8-shim that interoperates with Java >= 10 idioms for immutable collections.

The newest version!
package org.owasp.shim;

import java.util.*;

@SuppressWarnings("Since15") // We're compiling two versions to handle @since problems.
final class ForJava9AndLater extends Java8Shim {

    @Override public  List listOf() {
        return List.of();
    }

    @Override public  List listOf(T a) {
        return List.of(a);
    }

    @Override public  List listOf(T a, T b) {
        return List.of(a, b);
    }

    @Override public  List listOf(T a, T b, T c) {
        return List.of(a, b, c);
    }

    @Override public  List listOf(T... els) {
        return List.of(els);
    }

    @Override public  List listCopyOf(Collection c) {
        return List.copyOf(c);
    }

    @Override public  Map mapCopyOf(Map m) {
        return Map.copyOf(m);
    }

    @Override public  Map.Entry mapEntry(K key, V value) {
        return Map.entry(key, value);
    }

    @Override public  Map mapOfEntries(Map.Entry... entries) {
        return Map.ofEntries(entries);
    }

    @Override public  Set setOf() {
        return Set.of();
    }

    @Override public  Set setOf(T a) {
        return Set.of(a);
    }

    @Override public  Set setOf(T a, T b) {
        return Set.of(a, b);
    }

    @Override public  Set setOf(T a, T b, T c) {
        return Set.of(a, b, c);
    }

    @Override public  Set setOf(T... els) {
        return Set.of(els);
    }

    @Override public  Set setCopyOf(Collection c) {
        return Set.copyOf(c);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy