Using the Diamond Operator and Suppressing Unchecked Warnings(SuppressWarnings) : Diamond Operator « JDK 7 « Java






Using the Diamond Operator and Suppressing Unchecked Warnings(SuppressWarnings)


import java.util.ArrayList;
import java.util.List;

public class Test {

  public static void main(String[] args) {
  @SuppressWarnings("unchecked")
    List<String> arrayList = new ArrayList();
  }
}

 








Related examples in the same category

1.Using the Diamond Operator for Constructor Type Inference
2.Using the Diamond Operator when type is not obvious
3.Using the @SafeVarargs Annotation