[COLLECTIONS-562] Upgrade minimum java requirement to Java 6. Replace ArrayStack with ArrayDeque.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1681434 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2015-05-24 10:49:58 +00:00
parent 289e7a769e
commit 0e11402b98
5 changed files with 15 additions and 13 deletions

View File

@ -460,8 +460,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.5</maven.compiler.source>
<maven.compiler.target>1.5</maven.compiler.target>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<!--
This is also used to generate download_xxx file name.

View File

@ -22,6 +22,9 @@
<body>
<release version="4.1" date="TBD" description="">
<action issue="COLLECTIONS-562" dev="tn" type="update">
Upgraded minimum java requirement to Java 6 (up from Java 5).
</action>
<action issue="COLLECTIONS-395" dev="tn" type="add" due-to="David Hawthorne">
Added method "LRUMap#get(Object, boolean)" that allows to query the map
without affecting the least recently used order.

View File

@ -16,10 +16,11 @@
*/
package org.apache.commons.collections4.iterators;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.commons.collections4.ArrayStack;
import org.apache.commons.collections4.Transformer;
/**
@ -73,11 +74,10 @@ import org.apache.commons.collections4.Transformer;
* @since 3.1
* @version $Id$
*/
@SuppressWarnings("deprecation") // we use the deprecated ArrayStack - change to ArrayDeque (Java 1.6)
public class ObjectGraphIterator<E> implements Iterator<E> {
/** The stack of iterators */
private final ArrayStack<Iterator<? extends E>> stack = new ArrayStack<Iterator<? extends E>>(8);
private final Deque<Iterator<? extends E>> stack = new ArrayDeque<Iterator<? extends E>>(8);
/** The root object in the tree */
private E root;
/** The transformer to use */

View File

@ -17,10 +17,10 @@
*/
package org.apache.commons.collections4.iterators;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Iterator;
import org.apache.commons.collections4.ArrayStack;
/**
* Decorates an iterator to support pushback of elements.
* <p>
@ -33,14 +33,13 @@ import org.apache.commons.collections4.ArrayStack;
* @since 4.0
* @version $Id$
*/
@SuppressWarnings("deprecation") // replace ArrayStack with ArrayDeque when moving to Java 6
public class PushbackIterator<E> implements Iterator<E> {
/** The iterator being decorated. */
private final Iterator<? extends E> iterator;
/** The LIFO queue containing the pushed back items. */
private ArrayStack<E> items = new ArrayStack<E>();
private Deque<E> items = new ArrayDeque<E>();
//-----------------------------------------------------------------------
/**

View File

@ -17,13 +17,14 @@
package org.apache.commons.collections4.list;
import java.util.AbstractList;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Deque;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import org.apache.commons.collections4.ArrayStack;
import org.apache.commons.collections4.OrderedIterator;
/**
@ -54,7 +55,6 @@ import org.apache.commons.collections4.OrderedIterator;
* @since 3.1
* @version $Id$
*/
@SuppressWarnings("deprecation") // replace ArrayStack by ArrayDeque when moving to Java 1.6
public class TreeList<E> extends AbstractList<E> {
// add; toArray; iterator; insert; get; indexOf; remove
// TreeList = 1260;7360;3080; 160; 170;3400; 170;
@ -828,7 +828,7 @@ public class TreeList<E> extends AbstractList<E> {
// find a subtree, s, that is no taller than me. (While we are
// navigating left, we store the nodes we encounter in a stack
// so that we can re-balance them in step 4.)
final ArrayStack<AVLNode<E>> sAncestors = new ArrayStack<AVLNode<E>>();
final Deque<AVLNode<E>> sAncestors = new ArrayDeque<AVLNode<E>>();
AVLNode<E> s = otherTree;
int sAbsolutePosition = s.relativePosition + currentSize;
int sParentAbsolutePosition = 0;
@ -868,7 +868,7 @@ public class TreeList<E> extends AbstractList<E> {
}
otherTree = otherTree.removeMin();
final ArrayStack<AVLNode<E>> sAncestors = new ArrayStack<AVLNode<E>>();
final Deque<AVLNode<E>> sAncestors = new ArrayDeque<AVLNode<E>>();
AVLNode<E> s = this;
int sAbsolutePosition = s.relativePosition;
int sParentAbsolutePosition = 0;