Constructor and Description |
---|
ListDiff() |
Modifier and Type | Method and Description |
---|---|
void |
accept(ListDiffVisitor<E> visitor)
Traverses the
getDifferences() array, calling the appropriate
method in visitor for each difference. |
void |
applyTo(List<E> list)
Applies the changes in this diff to the given list
|
abstract ListDiffEntry<E>[] |
getDifferences()
Returns a ListDiffEntry array representing the differences in the list,
in the order they are to be processed.
|
boolean |
isEmpty()
Returns true if the diff contains no added, removed, moved or replaced
elements.
|
List<E> |
simulateOn(List<E> list)
Returns a list showing what
list would look like if this
diff were applied to it. |
String |
toString() |
public abstract ListDiffEntry<E>[] getDifferences()
This method returns identical results to
getDifferencesAsList
except that the results are returned as
a array and so the ListDiffEntry objects are not properly typed. This
form is here for compatibility. Use getDifferencesAsList
to
get typed results.
public void accept(ListDiffVisitor<E> visitor)
getDifferences()
array, calling the appropriate
method in visitor
for each difference.
ListDiffVisitor.handleReplace(int, Object, Object)
is called
whenever an add entry is adjacent to a remove entry, and both entries
operate on the same location in the list.
ListDiffVisitor.handleMove(int, int, Object)
is called
whenever an add entry is adjacent to a remove entry, and both entries
have equivalent elements.
ListDiffVisitor.handleRemove(int, Object)
is called whenever
a remove entry does not match conditions 1 or 2.
ListDiffVisitor.handleAdd(int, Object)
is called whenever an
add entry does not match conditions in 1 or 2.
visitor
- the visitor to receive callbacks.ListDiffVisitor
public boolean isEmpty()
public void applyTo(List<E> list)
list
- the list to which the diff will be appliedpublic List<E> simulateOn(List<E> list)
list
would look like if this
diff were applied to it.
Note: the returned list is only valid until structural changes are made to the passed-in list.
list
- the list over which the diff will be simulatedlist
would look
like if it were passed to the applyTo(List)
method.applyTo(List)
public String toString()
toString
in class Object
Object.toString()
Copyright (c) 2000, 2016 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.