getElement() now uses O(1) get from hash instead of linear O(n) search. Enables us to read large files easily.
This commit is contained in:
parent
f313e14e4e
commit
8056a3fe89
|
|
@ -107,11 +107,13 @@ public class DiffNode extends DiffValue {
|
|||
return getElements(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the element bound to name, or null if no such binding exists
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public DiffElement getElement(String name) {
|
||||
for ( DiffElement elt : getElements() )
|
||||
if ( elt.getName().equals(name) )
|
||||
return elt;
|
||||
return null;
|
||||
return getElementMap().get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue