jdk/src/share/classes/javax/accessibility/AccessibleStateSet.java
changeset 25553 1082bb71e6c5
parent 22584 eed64ee05369
equal deleted inserted replaced
25552:96abb01815f6 25553:1082bb71e6c5
    66      *
    66      *
    67      * @param states an array of AccessibleState describing the state set.
    67      * @param states an array of AccessibleState describing the state set.
    68      */
    68      */
    69     public AccessibleStateSet(AccessibleState[] states) {
    69     public AccessibleStateSet(AccessibleState[] states) {
    70         if (states.length != 0) {
    70         if (states.length != 0) {
    71             this.states = new Vector(states.length);
    71             this.states = new Vector<>(states.length);
    72             for (int i = 0; i < states.length; i++) {
    72             for (int i = 0; i < states.length; i++) {
    73                 if (!this.states.contains(states[i])) {
    73                 if (!this.states.contains(states[i])) {
    74                     this.states.addElement(states[i]);
    74                     this.states.addElement(states[i]);
    75                 }
    75                 }
    76             }
    76             }
    90     public boolean add(AccessibleState state) {
    90     public boolean add(AccessibleState state) {
    91         // [[[ PENDING:  WDW - the implementation of this does not need
    91         // [[[ PENDING:  WDW - the implementation of this does not need
    92         // to always use a vector of states.  It could be improved by
    92         // to always use a vector of states.  It could be improved by
    93         // caching the states as a bit set.]]]
    93         // caching the states as a bit set.]]]
    94         if (states == null) {
    94         if (states == null) {
    95             states = new Vector();
    95             states = new Vector<>();
    96         }
    96         }
    97 
    97 
    98         if (!states.contains(state)) {
    98         if (!states.contains(state)) {
    99             states.addElement(state);
    99             states.addElement(state);
   100             return true;
   100             return true;
   109      * @param states  AccessibleState array describing the state set.
   109      * @param states  AccessibleState array describing the state set.
   110      */
   110      */
   111     public void addAll(AccessibleState[] states) {
   111     public void addAll(AccessibleState[] states) {
   112         if (states.length != 0) {
   112         if (states.length != 0) {
   113             if (this.states == null) {
   113             if (this.states == null) {
   114                 this.states = new Vector(states.length);
   114                 this.states = new Vector<>(states.length);
   115             }
   115             }
   116             for (int i = 0; i < states.length; i++) {
   116             for (int i = 0; i < states.length; i++) {
   117                 if (!this.states.contains(states[i])) {
   117                 if (!this.states.contains(states[i])) {
   118                     this.states.addElement(states[i]);
   118                     this.states.addElement(states[i]);
   119                 }
   119                 }