ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1536523 - /ace/trunk/org.apache.ace.range.api/src/org/apache/ace/range/SortedRangeSet.java
Date Mon, 28 Oct 2013 21:03:40 GMT
Author: jawi
Date: Mon Oct 28 21:03:40 2013
New Revision: 1536523

URL: http://svn.apache.org/r1536523
Log:
Added generics (fixes compile warnings).

Modified:
    ace/trunk/org.apache.ace.range.api/src/org/apache/ace/range/SortedRangeSet.java

Modified: ace/trunk/org.apache.ace.range.api/src/org/apache/ace/range/SortedRangeSet.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.range.api/src/org/apache/ace/range/SortedRangeSet.java?rev=1536523&r1=1536522&r2=1536523&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.range.api/src/org/apache/ace/range/SortedRangeSet.java (original)
+++ ace/trunk/org.apache.ace.range.api/src/org/apache/ace/range/SortedRangeSet.java Mon Oct
28 21:03:40 2013
@@ -39,7 +39,7 @@ public class SortedRangeSet {
         }
     };
 
-    private List m_ranges = new ArrayList();
+    private List<Range> m_ranges = new ArrayList<Range>();
 
     /**
      * Creates a new instance from a string representation.
@@ -95,9 +95,9 @@ public class SortedRangeSet {
      */
     public String toRepresentation() {
         StringBuffer result = new StringBuffer();
-        Iterator i = m_ranges.iterator();
+        Iterator<Range> i = m_ranges.iterator();
         while (i.hasNext()) {
-            Range r = (Range) i.next();
+            Range r = i.next();
             if (result.length() > 0) {
                 result.append(',');
             }
@@ -134,9 +134,9 @@ public class SortedRangeSet {
      * @return <code>true</code> if the number was inside any range in this set
      */
     public boolean contains(long number) {
-        Iterator i = m_ranges.iterator();
+        Iterator<Range> i = m_ranges.iterator();
         while (i.hasNext()) {
-            Range r = (Range) i.next();
+            Range r = i.next();
             if (r.contains(number)) {
                 return true;
             }
@@ -150,10 +150,10 @@ public class SortedRangeSet {
      * @param number the number to add
      */
     private void add(long number) {
-        ListIterator i = m_ranges.listIterator();
+        ListIterator<Range> i = m_ranges.listIterator();
         while (i.hasNext()) {
             int index = i.nextIndex();
-            Range r = (Range) i.next();
+            Range r = i.next();
             if (r.contains(number)) {
                 return;
             }
@@ -222,7 +222,7 @@ public class SortedRangeSet {
     public long getHigh() {
         int size = m_ranges.size();
         if (size > 0) {
-            Range range = (Range) m_ranges.get(size - 1);
+            Range range = m_ranges.get(size - 1);
             return range.getHigh();
         }
         else {



Mime
View raw message