src/share/classes/javax/swing/text/GapContent.java

Print this page

        

@@ -708,11 +708,12 @@
      * @param v the Vector to use, with a new one created on null
      * @param offset the starting offset >= 0
      * @param length the length >= 0
      * @return the set of instances
      */
-    protected Vector getPositionsInRange(Vector v, int offset, int length) {
+    protected Vector<UndoPosRef> getPositionsInRange(Vector<UndoPosRef> v,
+                                                     int offset, int length) {
         int endOffset = offset + length;
         int startIndex;
         int endIndex;
         int g0 = getGapStart();
         int g1 = getGapEnd();

@@ -736,12 +737,13 @@
         else {
             startIndex = findMarkAdjustIndex(offset + (g1 - g0));
             endIndex = findMarkAdjustIndex(endOffset + (g1 - g0) + 1);
         }
 
-        Vector placeIn = (v == null) ? new Vector(Math.max(1, endIndex -
-                                                           startIndex)) : v;
+        Vector<UndoPosRef> placeIn = (v == null) ?
+            new Vector<>(Math.max(1, endIndex - startIndex)) :
+            v;
 
         for (int counter = startIndex; counter < endIndex; counter++) {
             placeIn.addElement(new UndoPosRef(marks.elementAt(counter)));
         }
         return placeIn;

@@ -754,11 +756,11 @@
      * This is meant for internal usage, and is generally not of interest
      * to subclasses.
      *
      * @param positions the UndoPosRef instances to reset
      */
-    protected void updateUndoPositions(Vector positions, int offset,
+    protected void updateUndoPositions(Vector<UndoPosRef> positions, int offset,
                                        int length) {
         // Find the indexs of the end points.
         int endOffset = offset + length;
         int g1 = getGapEnd();
         int startIndex;

@@ -771,11 +773,11 @@
             startIndex = 0;
         }
 
         // Reset the location of the refenences.
         for(int counter = positions.size() - 1; counter >= 0; counter--) {
-            UndoPosRef ref = (UndoPosRef)positions.elementAt(counter);
+            UndoPosRef ref = positions.elementAt(counter);
             ref.resetLocation(endOffset, g1);
         }
         // We have to resort the marks in the range startIndex to endIndex.
         // We can take advantage of the fact that it will be in
         // increasing order, accept there will be a bunch of MarkData's with

@@ -898,11 +900,11 @@
         /** The string that was inserted. This will only be valid after an
          * undo. */
         protected String string;
         /** An array of instances of UndoPosRef for the Positions in the
          * range that was removed, valid after undo. */
-        protected Vector posRefs;
+        protected Vector<UndoPosRef> posRefs;
     } // GapContent.InsertUndo
 
 
     /**
      * UndoableEdit created for removes.

@@ -950,8 +952,8 @@
         protected int length;
         /** The string that was removed. This is valid when redo is valid. */
         protected String string;
         /** An array of instances of UndoPosRef for the Positions in the
          * range that was removed, valid before undo. */
-        protected Vector posRefs;
+        protected Vector<UndoPosRef> posRefs;
     } // GapContent.RemoveUndo
 }