test/jdk/javadoc/doclet/testNewLanguageFeatures/pkg/TypeParameters.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -22,10 +22,11 @@
  */
 
 package pkg;
 
 import java.util.*;
+import java.util.function.Supplier;
 
 /**
  * Just a sample class with type parameters.  This is a link to myself:
  * {@link TypeParameters}
  *

@@ -65,6 +66,39 @@
      * @author Owner
      *
      * @param <A> This is the first type parameter.
      */
     public <A> void methodThatHasTypeParmaters(A... a) {}
-}
+
+    /**
+     * This method returns a TypeParameter array and takes in a TypeParameter array
+     * @param e an array of TypeParameters
+     * @return an array of TypeParameters
+     */
+    public E[] methodThatReturnsTypeParameterA(E[] e) { return null;}
+
+    /**
+     * Returns TypeParameters
+     * @param <T> a typeParameters
+     * @param coll a collection
+     * @return typeParameters
+     */
+    public <T extends Object & Comparable<? super T>> T
+        methodtThatReturnsTypeParametersB(Collection<? extends T> coll) {
+        return null;
+    }
+
+    /**
+     * Return the contained value, if present, otherwise throw an exception
+     * to be created by the provided supplier.
+     *
+     * @param <X> Type of the exception to be thrown
+     * @param exceptionSupplier The supplier which will return the exception to
+     * be thrown
+     * @return the present value
+     * @throws X if there is no value present
+     * @throws NullPointerException if no value is present and
+     * {@code exceptionSupplier} is null
+     */
+    public <X extends Throwable> E orElseThrow(Supplier<? extends X> exceptionSupplier) throws X {
+        return null;
+    }}