Data update
This commit is contained in:
parent
61b93a2cd1
commit
5af6d93694
858 changed files with 20572 additions and 2082 deletions
35
Task/Pragmatic-directives/Java/pragmatic-directives.java
Normal file
35
Task/Pragmatic-directives/Java/pragmatic-directives.java
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public final class PragmaticDirectives {
|
||||
|
||||
public static void main(String[] aArgs) {
|
||||
/* Take no action */
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Adder { // This annotation indicates a functional interface,
|
||||
abstract int add(int a, int b); // which has exactly one abstract method.
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void Display() {
|
||||
System.out.println("This author is indicating that this method is deprecated");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void uncheckedWarning() {
|
||||
List words = new ArrayList();
|
||||
words.add("hello");
|
||||
System.out.println("THe compiler is warning that the generic type declaration is missing.");
|
||||
System.out.println("The correct syntax is: List<String> words = new ArrayList<String>()");
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public static <T> List<T> list(final T... items) {
|
||||
System.out.println("This annotation suppresses unchecked warnings about a non-reifiable variable arity type");
|
||||
return Arrays.asList(items);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue