Created
February 27, 2015 04:01
-
-
Save ruimo/feff4f42fcea0c616a99 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import static java.util.Objects.requireNonNull; | |
class Foo<T> { | |
final List<T> members; | |
@SafeVarargs | |
Foo(T... a) { | |
members = new ArrayList<>(Arrays.asList(requireNonNull(a))); | |
} | |
} | |
public class Test { | |
public static void main(String... args) { | |
Foo<String> foo = new Foo<>("Hello", "World"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment