You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by vi...@apache.org on 2015/10/19 16:55:30 UTC

svn commit: r1709427 - /poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CombinedIterable.java

Author: virtuald
Date: Mon Oct 19 14:55:30 2015
New Revision: 1709427

URL: http://svn.apache.org/viewvc?rev=1709427&view=rev
Log:
XDGF: fix jdk < 1.8 compat

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CombinedIterable.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CombinedIterable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CombinedIterable.java?rev=1709427&r1=1709426&r2=1709427&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CombinedIterable.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CombinedIterable.java Mon Oct 19 14:55:30 2015
@@ -17,7 +17,6 @@
 
 package org.apache.poi.xdgf.usermodel.section;
 
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.Map.Entry;
 import java.util.NoSuchElementException;
@@ -35,14 +34,21 @@ public class CombinedIterable<T> impleme
     
     private static final class EmptyIterator<T> implements Iterator<T> {
 
+        @Override
         public boolean hasNext() {
             return false;
         }
 
+        @Override
         public T next() {
             return null;
         }
         
+        @Override
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+        
     }
 
     public CombinedIterable(SortedMap<Long, T> baseItems,



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Re: svn commit: r1709427 - /poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CombinedIterable.java

Posted by Dustin Spicuzza <du...@virtualroadside.com>.
Thanks, I was originally using Collections.emptyIterator(), but that's only available in Java 7+. I'll do it your way, that sounds easier anyways. :) 

Dustin

On 10/19/2015 1:30 PM, Uwe Schindler wrote:
> Just unrelated to the original fix:
> 
> According to checks, the EmptyIterator should throw NoSuchElementException.
> But I would remove the impl completely! It is much simpler to just return Collections.emptySet().iterator() when empty iterators are required; this is also just returning a static singleton, so no speed improvement at all!
> 
> Uwe
> 
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
> 
> 
>> -----Original Message-----
>> From: virtuald@apache.org [mailto:virtuald@apache.org]
>> Sent: Monday, October 19, 2015 4:56 PM
>> To: commits@poi.apache.org
>> Subject: svn commit: r1709427 -
>> /poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/Combi
>> nedIterable.java
>>
>> Author: virtuald
>> Date: Mon Oct 19 14:55:30 2015
>> New Revision: 1709427
>>
>> URL: http://svn.apache.org/viewvc?rev=1709427&view=rev
>> Log:
>> XDGF: fix jdk < 1.8 compat
>>
>> Modified:
>>
>> poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/Combin
>> edIterable.java
>>
>> Modified:
>> poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/Combin
>> edIterable.java
>> URL:
>> http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xd
>> gf/usermodel/section/CombinedIterable.java?rev=1709427&r1=1709426&r2
>> =1709427&view=diff
>> ==========================================================
>> ====================
>> ---
>> poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/Combin
>> edIterable.java (original)
>> +++
>> poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/Combi
>> +++ nedIterable.java Mon Oct 19 14:55:30 2015
>> @@ -17,7 +17,6 @@
>>
>>  package org.apache.poi.xdgf.usermodel.section;
>>
>> -import java.util.Collections;
>>  import java.util.Iterator;
>>  import java.util.Map.Entry;
>>  import java.util.NoSuchElementException; @@ -35,14 +34,21 @@ public
>> class CombinedIterable<T> impleme
>>
>>      private static final class EmptyIterator<T> implements Iterator<T> {
>>
>> +        @Override
>>          public boolean hasNext() {
>>              return false;
>>          }
>>
>> +        @Override
>>          public T next() {
>>              return null;
>>          }
>>
>> +        @Override
>> +        public void remove() {
>> +            throw new UnsupportedOperationException();
>> +        }
>> +
>>      }
>>
>>      public CombinedIterable(SortedMap<Long, T> baseItems,
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
>> For additional commands, e-mail: commits-help@poi.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
> 


-- 
Innovation is just a problem away


RE: svn commit: r1709427 - /poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CombinedIterable.java

Posted by Uwe Schindler <uw...@thetaphi.de>.
Just unrelated to the original fix:

According to checks, the EmptyIterator should throw NoSuchElementException.
But I would remove the impl completely! It is much simpler to just return Collections.emptySet().iterator() when empty iterators are required; this is also just returning a static singleton, so no speed improvement at all!

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: virtuald@apache.org [mailto:virtuald@apache.org]
> Sent: Monday, October 19, 2015 4:56 PM
> To: commits@poi.apache.org
> Subject: svn commit: r1709427 -
> /poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/Combi
> nedIterable.java
> 
> Author: virtuald
> Date: Mon Oct 19 14:55:30 2015
> New Revision: 1709427
> 
> URL: http://svn.apache.org/viewvc?rev=1709427&view=rev
> Log:
> XDGF: fix jdk < 1.8 compat
> 
> Modified:
> 
> poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/Combin
> edIterable.java
> 
> Modified:
> poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/Combin
> edIterable.java
> URL:
> http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xd
> gf/usermodel/section/CombinedIterable.java?rev=1709427&r1=1709426&r2
> =1709427&view=diff
> ==========================================================
> ====================
> ---
> poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/Combin
> edIterable.java (original)
> +++
> poi/trunk/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/Combi
> +++ nedIterable.java Mon Oct 19 14:55:30 2015
> @@ -17,7 +17,6 @@
> 
>  package org.apache.poi.xdgf.usermodel.section;
> 
> -import java.util.Collections;
>  import java.util.Iterator;
>  import java.util.Map.Entry;
>  import java.util.NoSuchElementException; @@ -35,14 +34,21 @@ public
> class CombinedIterable<T> impleme
> 
>      private static final class EmptyIterator<T> implements Iterator<T> {
> 
> +        @Override
>          public boolean hasNext() {
>              return false;
>          }
> 
> +        @Override
>          public T next() {
>              return null;
>          }
> 
> +        @Override
> +        public void remove() {
> +            throw new UnsupportedOperationException();
> +        }
> +
>      }
> 
>      public CombinedIterable(SortedMap<Long, T> baseItems,
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
> For additional commands, e-mail: commits-help@poi.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org