File tree Expand file tree Collapse file tree 5 files changed +62
-46
lines changed
src/main/java/com/fasterxml/sort Expand file tree Collapse file tree 5 files changed +62
-46
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,12 @@ Here are individuals who have contributed to development of this project.
3
3
4
4
Tatu Saloranta,
[email protected] : author
5
5
6
-
6
+
7
7
8
8
* Reported [Issue#6]: broken handling of '\r' (on Windows)
9
9
(0.7.2)
10
+
11
+ Nathan Williams (nathanlws@github)
12
+
13
+ * Contributed #10: Add Iterator-based(pull-style) sorter as an alternative
14
+ (0.9.0)
Original file line number Diff line number Diff line change 1
1
Project: java-merge-sort
2
2
License: Apache License 2.0
3
- Version: 0.8.1
4
- Release date: 07-Aug -2013
3
+ Version: 0.9.0
4
+ Release date: xx-Oct -2013
5
5
6
- #8: Sorter._merge() not closing streams correctly
7
- (reported by tjoneslo@github )
6
+ #10: Add Iterator-based (pull-style) sorter as an alternative
7
+ (contributed by Nathan W )
8
8
9
9
------------------------------------------------------------------------
10
10
=== History: ===
11
11
------------------------------------------------------------------------
12
12
13
+ 0.8.1 (07-Aug-2013)
14
+
15
+ #8: Sorter._merge() not closing streams correctly
16
+ (reported by tjoneslo@github)
17
+
13
18
0.8.0 (24-Jul-2013)
14
19
15
- * [Issue#6] : Incorrect handling of '\r'
20
+ #6 : Incorrect handling of '\r'
16
21
(reported, patch contributed by
[email protected] )
17
22
18
23
0.7.1 (29-May-2012)
19
24
20
- * [Issue#5] : Unnecessary object retention, leading to too high memory usage
25
+ #5 : Unnecessary object retention, leading to too high memory usage
21
26
(reported by Paul Smith)
22
27
23
28
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .sort ;
2
+
3
+ import java .io .IOException ;
4
+ import java .util .Iterator ;
5
+
6
+ /**
7
+ * We need an unchecked exception to work with {@link Iterator}, and
8
+ * want a specific subtype to catch.
9
+ */
10
+ public class IterableSorterException extends RuntimeException {
11
+ private static final long serialVersionUID = 1L ;
12
+
13
+ public IterableSorterException (IOException cause ) {
14
+ super (cause );
15
+ }
16
+ }
Original file line number Diff line number Diff line change 1
1
package com .fasterxml .sort ;
2
2
3
+ import com .fasterxml .sort .util .CastingIterator ;
3
4
import com .fasterxml .sort .util .SegmentedBuffer ;
4
5
5
6
import java .io .Closeable ;
@@ -137,50 +138,12 @@ public void close() {
137
138
_merger = null ;
138
139
}
139
140
140
-
141
- /*
142
- /**********************************************************************
143
- /* Exception API
144
- /**********************************************************************
145
- */
146
-
147
- public static class IterableSorterException extends RuntimeException {
148
- public IterableSorterException (IOException cause ) {
149
- super (cause );
150
- }
151
- }
152
-
153
-
154
141
/*
155
142
/**********************************************************************
156
- /* Iterator API
143
+ /* Iterator implementations
157
144
/**********************************************************************
158
145
*/
159
146
160
- private static class CastingIterator <T > implements Iterator <T > {
161
- private final Iterator <Object > _it ;
162
-
163
- public CastingIterator (Iterator <Object > it ) {
164
- _it = it ;
165
- }
166
-
167
- @ Override
168
- public boolean hasNext () {
169
- return _it .hasNext ();
170
- }
171
-
172
- @ SuppressWarnings ("unchecked" )
173
- @ Override
174
- public T next () {
175
- return (T )_it .next ();
176
- }
177
-
178
- @ Override
179
- public void remove () {
180
- throw new UnsupportedOperationException ();
181
- }
182
- }
183
-
184
147
private static class MergerIterator <T > implements Iterator <T > {
185
148
private final DataReader <T > _merger ;
186
149
private T _next ;
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .sort .util ;
2
+
3
+ import java .util .Iterator ;
4
+
5
+ public class CastingIterator <T > implements Iterator <T > {
6
+ private final Iterator <Object > _it ;
7
+
8
+ public CastingIterator (Iterator <Object > it ) {
9
+ _it = it ;
10
+ }
11
+
12
+ @ Override
13
+ public boolean hasNext () {
14
+ return _it .hasNext ();
15
+ }
16
+
17
+ @ SuppressWarnings ("unchecked" )
18
+ @ Override
19
+ public T next () {
20
+ return (T )_it .next ();
21
+ }
22
+
23
+ @ Override
24
+ public void remove () {
25
+ throw new UnsupportedOperationException ();
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments