You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2020/12/31 18:29:21 UTC
svn commit: r1884993 - in /pivot/trunk:
core/src/org/apache/pivot/collections/
core/src/org/apache/pivot/collections/adapter/
core/src/org/apache/pivot/functional/monad/ tests/src/org/apache/pivot/tests/
Author: rwhitcomb
Date: Thu Dec 31 18:29:20 2020
New Revision: 1884993
URL: http://svn.apache.org/viewvc?rev=1884993&view=rev
Log:
More "checkstyle" fixes to "core" classes, plus misc. cleanup.
Modified:
pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java
pivot/trunk/core/src/org/apache/pivot/collections/ArrayStack.java
pivot/trunk/core/src/org/apache/pivot/collections/Group.java
pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java
pivot/trunk/core/src/org/apache/pivot/collections/Queue.java
pivot/trunk/core/src/org/apache/pivot/collections/Stack.java
pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java
pivot/trunk/core/src/org/apache/pivot/functional/monad/TryCompanion.java
pivot/trunk/tests/src/org/apache/pivot/tests/TestUtils.java
Modified: pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java?rev=1884993&r1=1884992&r2=1884993&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/ArrayQueue.java Thu Dec 31 18:29:20 2020
@@ -25,40 +25,72 @@ import org.apache.pivot.util.ListenerLis
import org.apache.pivot.util.Utils;
/**
- * Implementation of the {@link Queue} interface that is backed by an array.
+ * Implementation of the {@link Queue} interface that is backed by an {@link ArrayList}.
+ *
+ * @param <T> The type of object stored in this queue.
*/
public class ArrayQueue<T> implements Queue<T>, Serializable {
private static final long serialVersionUID = -3856732506886968324L;
+ /** The underlying array list used to implement this queue. */
private ArrayList<T> arrayList = new ArrayList<>();
+ /** The maximum permitted length of the queue (0 = unlimited). */
private int maxLength = 0;
+ /** List of queue listeners for this queue. */
private transient QueueListener.Listeners<T> queueListeners = new QueueListener.Listeners<>();
+ /**
+ * Construct an empty queue, with all defaults.
+ */
public ArrayQueue() {
this(null);
}
- public ArrayQueue(Comparator<T> comparator) {
+ /**
+ * Construct an empty queue with the given comparator used to order the elements in it.
+ *
+ * @param comparator A comparator used to sort the elements in the queue as they are added.
+ */
+ public ArrayQueue(final Comparator<T> comparator) {
setComparator(comparator);
}
- public ArrayQueue(int capacity) {
+ /**
+ * Construct an empty queue with a given initial capacity.
+ *
+ * @param capacity The initial capacity for the queue.
+ */
+ public ArrayQueue(final int capacity) {
ensureCapacity(capacity);
}
- public ArrayQueue(int capacity, int maxLength) {
+ /**
+ * Construct an empty queue with a given initial capacity and maxmimum length.
+ *
+ * @param capacity The initial capacity for the queue.
+ * @param maxLen The maximum permitted queue length.
+ */
+ public ArrayQueue(final int capacity, final int maxLen) {
ensureCapacity(capacity);
- setMaxLength(maxLength);
+ setMaxLength(maxLen);
}
- public ArrayQueue(int capacity, int maxLength, Comparator<T> comparator) {
+ /**
+ * Construct an empty queue with a given initial capacity, maximum length,
+ * and comparator for ordering the queue.
+ *
+ * @param capacity The initial capacity for the queue.
+ * @param maxLen The maximum permitted queue length.
+ * @param comparator The comparator to use for ordering the elements.
+ */
+ public ArrayQueue(final int capacity, final int maxLen, final Comparator<T> comparator) {
ensureCapacity(capacity);
- setMaxLength(maxLength);
+ setMaxLength(maxLen);
setComparator(comparator);
}
@Override
- public void enqueue(T item) {
+ public void enqueue(final T item) {
if (maxLength == 0 || arrayList.getLength() < maxLength) {
if (getComparator() == null) {
arrayList.insert(item, 0);
@@ -118,12 +150,19 @@ public class ArrayQueue<T> implements Qu
}
@Override
- public void setMaxLength(int maxLength) {
- Utils.checkNonNegative(maxLength, "maxLength");
- this.maxLength = maxLength;
+ public void setMaxLength(final int maxLen) {
+ Utils.checkNonNegative(maxLen, "maxLen");
+ this.maxLength = maxLen;
}
- public void ensureCapacity(int capacity) {
+ /**
+ * Ensure that the queue has sufficient internal capacity to satisfy
+ * the given number of elements.
+ *
+ * @param capacity The capacity to ensure (to make sure no further
+ * allocations are done to accommodate this number of elements).
+ */
+ public void ensureCapacity(final int capacity) {
arrayList.ensureCapacity(capacity);
}
@@ -132,8 +171,19 @@ public class ArrayQueue<T> implements Qu
return arrayList.getComparator();
}
+ /**
+ * Set/remove the comparator for this queue.
+ * <p> If a new comparator is set the queue will be reordered
+ * if it contains any elements. Removing the comparator will not
+ * reorder any elements.
+ * <p> Calls the {@link QueueListener#comparatorChanged} method for
+ * each registered listener after setting the new comparator.
+ *
+ * @param comparator The new comparator used to order the elements
+ * in the queue. Can be {@code null} to remove the existing comparator.
+ */
@Override
- public void setComparator(Comparator<T> comparator) {
+ public void setComparator(final Comparator<T> comparator) {
Comparator<T> previousComparator = getComparator();
arrayList.setComparator(comparator);
Modified: pivot/trunk/core/src/org/apache/pivot/collections/ArrayStack.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/ArrayStack.java?rev=1884993&r1=1884992&r2=1884993&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/ArrayStack.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/ArrayStack.java Thu Dec 31 18:29:20 2020
@@ -25,35 +25,69 @@ import org.apache.pivot.util.ListenerLis
import org.apache.pivot.util.Utils;
/**
- * Implementation of the {@link Stack} interface that is backed by an array.
+ * Implementation of the {@link Stack} interface that is backed by an {@link ArrayList}.
+ * <p> Note: a stack with a comparator set is more like a priority queue than a stack
+ * because it no longer maintains the LIFO (last-in, first-out) ordering of a normal stack.
+ *
+ * @param <T> The type of elements stored in this stack.
*/
public class ArrayStack<T> implements Stack<T>, Serializable {
private static final long serialVersionUID = 3175064065273930731L;
+ /** The backing array for this stack. */
private ArrayList<T> arrayList = new ArrayList<>();
+ /** The maximum permitted stack depth (0 = unlimited). */
private int maxDepth = 0;
+ /** The list of listeners for changes in the stack. */
private transient StackListener.Listeners<T> stackListeners = new StackListener.Listeners<>();
+ /**
+ * Construct an empty stack, with all defaults.
+ */
public ArrayStack() {
this(null);
}
- public ArrayStack(Comparator<T> comparator) {
+ /**
+ * Construct an empty stack with the given comparator used to order the elemnts in it.
+ *
+ * @param comparator A comparator used to sort the elements in the stack as they are pushed.
+ */
+ public ArrayStack(final Comparator<T> comparator) {
setComparator(comparator);
}
- public ArrayStack(int capacity) {
+ /**
+ * Construct an empty stack with the given initial capacity.
+ *
+ * @param capacity The initial capacity for the stack.
+ */
+ public ArrayStack(final int capacity) {
ensureCapacity(capacity);
}
- public ArrayStack(int capacity, int maxDepth) {
+ /**
+ * Construct an empty stack with the given initial capacity and maximum depth.
+ *
+ * @param capacity The initial capacity for the stack.
+ * @param depth The maximum depth to enforce for this stack (0 = unlimited).
+ */
+ public ArrayStack(final int capacity, final int depth) {
ensureCapacity(capacity);
- setMaxDepth(maxDepth);
+ setMaxDepth(depth);
}
- public ArrayStack(int capacity, int maxDepth, Comparator<T> comparator) {
+ /**
+ * Construct an empty stack with the given initial capacity, maximum stack
+ * depth, and comparator used to order the stack elements.
+ *
+ * @param capacity The initial stack capacity.
+ * @param depth The maximum stack depth to enforce (0 = unlimited).
+ * @param comparator The comparator to use to order the stack elements.
+ */
+ public ArrayStack(final int capacity, final int depth, final Comparator<T> comparator) {
ensureCapacity(capacity);
- setMaxDepth(maxDepth);
+ setMaxDepth(depth);
setComparator(comparator);
}
@@ -69,16 +103,16 @@ public class ArrayStack<T> implements St
/**
* Set the maximum depth permitted for this stack, 0 means unlimited.
*
- * @param maxDepth The new maximum depth for this stack.
+ * @param depth The new maximum depth for this stack.
*/
@Override
- public void setMaxDepth(int maxDepth) {
- Utils.checkNonNegative(maxDepth, "maxDepth");
- this.maxDepth = maxDepth;
+ public void setMaxDepth(final int depth) {
+ Utils.checkNonNegative(depth, "maxDepth");
+ this.maxDepth = depth;
}
@Override
- public void push(T item) {
+ public void push(final T item) {
arrayList.add(item);
stackListeners.itemPushed(this, item);
@@ -130,7 +164,14 @@ public class ArrayStack<T> implements St
return arrayList.getLength();
}
- public void ensureCapacity(int capacity) {
+ /**
+ * Ensure that the stack has sufficient internal capacity to satisfy
+ * the given number of elements.
+ *
+ * @param capacity The capacity to ensure (to make sure no further
+ * allocations are done to accommodate this number of elements).
+ */
+ public void ensureCapacity(final int capacity) {
arrayList.ensureCapacity(capacity);
}
@@ -139,8 +180,21 @@ public class ArrayStack<T> implements St
return arrayList.getComparator();
}
+ /**
+ * Set/remove the comparator for this stack.
+ * <p> Setting a non-null comparator changes this stack to a priority
+ * queue, because LIFO ordering is no longer maintained.
+ * <p> If a new comparator is set the stack will be reordered
+ * if it contains any elements. Removing the comparator will not
+ * reorder any elements.
+ * <p> Calls the {@link StackListener#comparatorChanged} method for
+ * each registered listener after setting the new comparator.
+ *
+ * @param comparator The new comparator used to order the elements
+ * in the stack. Can be {@code null} to remove the existing comparator.
+ */
@Override
- public void setComparator(Comparator<T> comparator) {
+ public void setComparator(final Comparator<T> comparator) {
Comparator<T> previousComparator = getComparator();
arrayList.setComparator(comparator);
Modified: pivot/trunk/core/src/org/apache/pivot/collections/Group.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/Group.java?rev=1884993&r1=1884992&r2=1884993&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/Group.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/Group.java Thu Dec 31 18:29:20 2020
@@ -18,6 +18,8 @@ package org.apache.pivot.collections;
/**
* Interface representing a group of unique elements.
+ *
+ * @param <E> Type of element stored in the group.
*/
public interface Group<E> {
/**
@@ -27,7 +29,7 @@ public interface Group<E> {
* @return {@code true} if the element was added to the group;
* {@code false}, otherwise.
*/
- public boolean add(E element);
+ boolean add(E element);
/**
* Removes an element from the group.
@@ -36,7 +38,7 @@ public interface Group<E> {
* @return {@code true} if the element was removed from the group;
* {@code false}, otherwise.
*/
- public boolean remove(E element);
+ boolean remove(E element);
/**
* Tests the existence of an element in the group.
@@ -45,5 +47,5 @@ public interface Group<E> {
* @return {@code true} if the element exists in the group; {@code false},
* otherwise.
*/
- public boolean contains(E element);
+ boolean contains(E element);
}
Modified: pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java?rev=1884993&r1=1884992&r2=1884993&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java Thu Dec 31 18:29:20 2020
@@ -24,12 +24,15 @@ import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.pivot.util.ListenerList;
+import org.apache.pivot.util.StringUtils;
import org.apache.pivot.util.Utils;
/**
* Implementation of the {@link List} interface that is backed by a linked list.
* <p> NOTE This class is not thread-safe. For concurrent access, use a
* {@link org.apache.pivot.collections.concurrent.SynchronizedList}.
+ *
+ * @param <T> The type of object stored in the list.
*/
public class LinkedList<T> implements List<T>, Serializable {
private static final long serialVersionUID = 2100691224732602812L;
@@ -41,7 +44,7 @@ public class LinkedList<T> implements Li
private Node<T> next;
private T item;
- public Node(Node<T> previous, Node<T> next, T item) {
+ public Node(final Node<T> previous, final Node<T> next, final T item) {
this.previous = previous;
this.next = next;
this.item = item;
@@ -53,15 +56,15 @@ public class LinkedList<T> implements Li
private Node<T> current = null;
private boolean forward = false;
- private int modificationCountLocal;
+ private int localModificationCount;
public LinkedListItemIterator() {
- modificationCountLocal = LinkedList.this.modificationCount;
+ localModificationCount = LinkedList.this.modificationCount;
}
@Override
public boolean hasNext() {
- if (modificationCountLocal != LinkedList.this.modificationCount) {
+ if (localModificationCount != LinkedList.this.modificationCount) {
throw new ConcurrentModificationException();
}
@@ -90,7 +93,7 @@ public class LinkedList<T> implements Li
@Override
public boolean hasPrevious() {
- if (modificationCountLocal != LinkedList.this.modificationCount) {
+ if (localModificationCount != LinkedList.this.modificationCount) {
throw new ConcurrentModificationException();
}
@@ -128,7 +131,7 @@ public class LinkedList<T> implements Li
}
@Override
- public void insert(T item) {
+ public void insert(final T item) {
Node<T> next = null;
Node<T> previous = null;
@@ -163,7 +166,7 @@ public class LinkedList<T> implements Li
LinkedList.this.insert(item, previous, next);
length++;
- modificationCountLocal++;
+ localModificationCount++;
LinkedList.this.modificationCount++;
if (listListeners != null) {
@@ -172,7 +175,7 @@ public class LinkedList<T> implements Li
}
@Override
- public void update(T item) {
+ public void update(final T item) {
if (current == null) {
throw new IllegalStateException();
}
@@ -183,7 +186,7 @@ public class LinkedList<T> implements Li
verifyLocation(item, current.previous, current.next);
current.item = item;
- modificationCountLocal++;
+ localModificationCount++;
LinkedList.this.modificationCount++;
if (listListeners != null) {
@@ -219,7 +222,7 @@ public class LinkedList<T> implements Li
}
length--;
- modificationCountLocal++;
+ localModificationCount++;
LinkedList.this.modificationCount++;
if (listListeners != null) {
@@ -244,18 +247,18 @@ public class LinkedList<T> implements Li
public LinkedList() {
}
- public LinkedList(Comparator<T> comparator) {
+ public LinkedList(final Comparator<T> comparator) {
this.comparator = comparator;
}
@SafeVarargs
- public LinkedList(T... items) {
+ public LinkedList(final T... items) {
for (T item : items) {
add(item);
}
}
- public LinkedList(Sequence<T> items) {
+ public LinkedList(final Sequence<T> items) {
Utils.checkNull(items, "items");
for (int i = 0, n = items.getLength(); i < n; i++) {
@@ -264,7 +267,7 @@ public class LinkedList<T> implements Li
}
@Override
- public int add(T item) {
+ public int add(final T item) {
int index;
if (comparator == null) {
@@ -300,7 +303,7 @@ public class LinkedList<T> implements Li
}
@Override
- public void insert(T item, int index) {
+ public void insert(final T item, final int index) {
Utils.checkIndexBounds(index, 0, length);
Node<T> next = null;
@@ -323,7 +326,7 @@ public class LinkedList<T> implements Li
}
}
- private void insert(T item, Node<T> previous, Node<T> next) {
+ private void insert(final T item, final Node<T> previous, final Node<T> next) {
Node<T> node = new Node<>(previous, next, item);
if (previous == null) {
@@ -340,7 +343,7 @@ public class LinkedList<T> implements Li
}
@Override
- public T update(int index, T item) {
+ public T update(final int index, final T item) {
Utils.checkIndexBounds(index, 0, length - 1);
// Get the previous item at index
@@ -363,7 +366,7 @@ public class LinkedList<T> implements Li
return previousItem;
}
- private void verifyLocation(T item, Node<T> previous, Node<T> next) {
+ private void verifyLocation(final T item, final Node<T> previous, final Node<T> next) {
if (comparator != null) {
// Ensure that the new item is greater or equal to its
// predecessor and less than or equal to its successor
@@ -375,7 +378,7 @@ public class LinkedList<T> implements Li
}
@Override
- public int remove(T item) {
+ public int remove(final T item) {
int index = 0;
LinkedListItemIterator nodeIterator = new LinkedListItemIterator();
@@ -396,7 +399,7 @@ public class LinkedList<T> implements Li
}
@Override
- public Sequence<T> remove(int index, int count) {
+ public Sequence<T> remove(final int index, final int count) {
Utils.checkIndexBounds(index, count, 0, length);
LinkedList<T> removed = new LinkedList<>();
@@ -463,14 +466,14 @@ public class LinkedList<T> implements Li
}
@Override
- public T get(int index) {
+ public T get(final int index) {
Utils.checkIndexBounds(index, 0, length - 1);
Node<T> node = getNode(index);
return node.item;
}
- private Node<T> getNode(int index) {
+ private Node<T> getNode(final int index) {
Node<T> node;
if (index == 0) {
node = first;
@@ -494,7 +497,7 @@ public class LinkedList<T> implements Li
}
@Override
- public int indexOf(T item) {
+ public int indexOf(final T item) {
int index = 0;
Node<T> node = first;
@@ -537,7 +540,7 @@ public class LinkedList<T> implements Li
@SuppressWarnings("unchecked")
@Override
- public void setComparator(Comparator<T> comparator) {
+ public void setComparator(final Comparator<T> comparator) {
Comparator<T> previousComparator = this.comparator;
if (comparator != null) {
@@ -595,7 +598,7 @@ public class LinkedList<T> implements Li
@Override
@SuppressWarnings("unchecked")
- public boolean equals(Object o) {
+ public boolean equals(final Object o) {
boolean equals = false;
if (this == o) {
@@ -633,20 +636,8 @@ public class LinkedList<T> implements Li
public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append(getClass().getName());
- sb.append(" [");
-
- int i = 0;
- for (T item : this) {
- if (i > 0) {
- sb.append(", ");
- }
-
- sb.append(item);
- i++;
- }
-
- sb.append("]");
+ sb.append(getClass().getSimpleName());
+ StringUtils.append(sb, this);
return sb.toString();
}
Modified: pivot/trunk/core/src/org/apache/pivot/collections/Queue.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/Queue.java?rev=1884993&r1=1884992&r2=1884993&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/Queue.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/Queue.java Thu Dec 31 18:29:20 2020
@@ -21,18 +21,20 @@ import org.apache.pivot.util.ListenerLis
/**
* Interface representing a first-in, first-out (FIFO) queue when unsorted, and
* a priority queue when sorted.
+ *
+ * @param <T> The type of object kept in the queue.
*/
public interface Queue<T> extends Collection<T> {
/**
* Enqueues an item. If the queue is unsorted, the item is added at the tail
* of the queue (index <code>0</code>). Otherwise, it is inserted at the
- * appropriate index.
+ * appropriate index according to the priority/sort order.
* <p> If there is a maximum queue length defined and the queue is already at
* the maximum length this new item will not be queued.
*
* @param item The item to add to the queue.
*/
- public void enqueue(T item);
+ void enqueue(T item);
/**
* Removes the item from the head of the queue and returns it. Calling this
@@ -40,7 +42,7 @@ public interface Queue<T> extends Collec
* 1);</code>
* @return The (removed) object at the head of the queue.
*/
- public T dequeue();
+ T dequeue();
/**
* Returns the item at the head of the queue without removing it from the
@@ -49,7 +51,7 @@ public interface Queue<T> extends Collec
* distinguish between these two cases.
* @return The object at the head of the queue (not removed from the queue).
*/
- public T peek();
+ T peek();
/**
* Tests the emptiness of the queue.
@@ -58,27 +60,27 @@ public interface Queue<T> extends Collec
* otherwise.
*/
@Override
- public boolean isEmpty();
+ boolean isEmpty();
/**
* @return The length of the queue.
*/
- public int getLength();
+ int getLength();
/**
* @return The maximum queue length allowed (0 means unlimited).
*/
- public int getMaxLength();
+ int getMaxLength();
/**
* Set the maximum allowed queue length (0 means unlimited).
*
* @param maxLength The maximum allowed length.
*/
- public void setMaxLength(int maxLength);
+ void setMaxLength(int maxLength);
/**
* @return The queue listener list.
*/
- public ListenerList<QueueListener<T>> getQueueListeners();
+ ListenerList<QueueListener<T>> getQueueListeners();
}
Modified: pivot/trunk/core/src/org/apache/pivot/collections/Stack.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/Stack.java?rev=1884993&r1=1884992&r2=1884993&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/Stack.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/Stack.java Thu Dec 31 18:29:20 2020
@@ -21,6 +21,8 @@ import org.apache.pivot.util.ListenerLis
/**
* Interface representing a last-in, first-out (LIFO) stack when unsorted, and a
* priority stack when sorted.
+ *
+ * @param <T> The type of element kept in the stack.
*/
public interface Stack<T> extends Collection<T> {
/**
@@ -33,7 +35,7 @@ public interface Stack<T> extends Collec
*
* @param item The item to push onto the stack.
*/
- public void push(T item);
+ void push(T item);
/**
* Removes the top item from the stack and returns it.
@@ -41,7 +43,7 @@ public interface Stack<T> extends Collec
* @return The top item from the stack (removed from it).
* @throws IllegalStateException If the stack contains no items.
*/
- public T pop();
+ T pop();
/**
* Returns the item on top of the stack without removing it from the stack.
@@ -50,7 +52,7 @@ public interface Stack<T> extends Collec
* distinguish between these two cases.
* @return The top item from the stack (which remains there).
*/
- public T peek();
+ T peek();
/**
* Tests the emptiness of the stack.
@@ -59,27 +61,27 @@ public interface Stack<T> extends Collec
* otherwise.
*/
@Override
- public boolean isEmpty();
+ boolean isEmpty();
/**
* @return The stack depth.
*/
- public int getDepth();
+ int getDepth();
/**
* @return The maximum permitted stack/queue length (0 = unlimited).
*/
- public int getMaxDepth();
+ int getMaxDepth();
/**
* Set the maximum permitted stack/queue depth (0 = unlimited).
*
* @param maxDepth The new maximum depth.
*/
- public void setMaxDepth(int maxDepth);
+ void setMaxDepth(int maxDepth);
/**
* @return The stack listener list.
*/
- public ListenerList<StackListener<T>> getStackListeners();
+ ListenerList<StackListener<T>> getStackListeners();
}
Modified: pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java?rev=1884993&r1=1884992&r2=1884993&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java Thu Dec 31 18:29:20 2020
@@ -34,7 +34,9 @@ import org.apache.pivot.util.Utils;
/**
* Implementation of the {@link List} interface that is backed by an instance of
- * {@link java.util.List}.
+ * {@link java.util.List}; in other words, adapting a <tt>java.util.List</tt> to
+ * one of our <tt>List</tt>s.
+ *
* @param <T> Type of elements in the list.
*/
public class ListAdapter<T> implements List<T>, Serializable {
@@ -178,9 +180,8 @@ public class ListAdapter<T> implements L
java.util.List<T> removedList = null;
try {
removedList = list.getClass().getDeclaredConstructor().newInstance();
- } catch (IllegalAccessException | InstantiationException exception) {
- throw new RuntimeException(exception);
- } catch (NoSuchMethodException | InvocationTargetException exception) {
+ } catch (IllegalAccessException | InstantiationException
+ | NoSuchMethodException | InvocationTargetException exception) {
throw new RuntimeException(exception);
}
Modified: pivot/trunk/core/src/org/apache/pivot/functional/monad/TryCompanion.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/monad/TryCompanion.java?rev=1884993&r1=1884992&r2=1884993&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/functional/monad/TryCompanion.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/functional/monad/TryCompanion.java Thu Dec 31 18:29:20 2020
@@ -20,6 +20,8 @@ import java.util.Objects;
/**
* Utility class for additional Try methods.
+ *
+ * @param <T> The value type for this Try (on success).
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public final class TryCompanion<T> {
Modified: pivot/trunk/tests/src/org/apache/pivot/tests/TestUtils.java
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/TestUtils.java?rev=1884993&r1=1884992&r2=1884993&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/TestUtils.java (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/TestUtils.java Thu Dec 31 18:29:20 2020
@@ -21,11 +21,19 @@ package org.apache.pivot.tests;
*/
public final class TestUtils {
+ /** What we print out if the system property is not available (because of
+ * the {@link SecurityManager} settings.
+ */
private static final String NA = "not available";
+ /** Private constructor for a test class with only static methods. */
private TestUtils() {
}
+ /**
+ * Test several system properties that could be subject to {@link SecurityManager}
+ * restrictions.
+ */
static void testJavaSecurity() {
try {
System.out.println("The current SecurityManager is: " + System.getSecurityManager());