本文整理了Java中net.sf.ehcache.Element.equals()
方法的一些代码示例,展示了Element.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.equals()
方法的具体详情如下:
包路径:net.sf.ehcache.Element
类名称:Element
方法名:equals
[英]Equals comparison with another element, based on the key.
[中]
代码示例来源:origin: net.sf.ehcache/ehcache
@Override
public boolean contains(Object o) {
if (!(o instanceof Entry))
return false;
Entry,?> e = (Entry,?>)o;
Element v = SelectableConcurrentHashMap.this.get(e.getKey());
return v != null && v.equals(e.getValue());
}
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* Finds the best eviction candidate based on the sampled elements. What distuingishes this approach
* from the classic data structures approach, is that an Element contains metadata which can be used
* for making policy decisions, while generic data structures do not.
*
* @param sampledElements this should be a random subset of the population
* @param justAdded we never want to select the element just added. May be null.
* @return the least hit
*/
public Element selectedBasedOnPolicy(Element[] sampledElements, Element justAdded) {
//edge condition when Memory Store configured to size 0
if (sampledElements.length == 1) {
return sampledElements[0];
}
Element lowestElement = null;
for (Element element : sampledElements) {
if (element == null) {
continue;
}
if (lowestElement == null) {
if (!element.equals(justAdded)) {
lowestElement = element;
}
} else if (compare(lowestElement, element) && !element.equals(justAdded)) {
lowestElement = element;
}
}
return lowestElement;
}
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* {@inheritDoc}
*/
public boolean equals(Element e1, Element e2) {
if (e1 == null && e2 == null) {
return true;
} else if (e1 != null && e1.equals(e2)) {
if (e1.getObjectValue() == null) {
return e2.getObjectValue() == null;
} else {
return compareValues(e1.getObjectValue(), e2.getObjectValue());
}
} else {
return false;
}
}
代码示例来源:origin: org.terracotta.modules/tim-ehcache-2.0
private static boolean fullElementEquals(Element e1, Element e2) {
if (e1.equals(e2)) {
if (e1.getObjectValue() == null) {
return e2.getObjectValue() == null;
} else {
return e1.getObjectValue().equals(e2.getObjectValue());
}
} else {
return false;
}
}
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
@Override
public boolean contains(Object o) {
if (!(o instanceof Entry))
return false;
Entry,?> e = (Entry,?>)o;
Element v = SelectableConcurrentHashMap.this.get(e.getKey());
return v != null && v.equals(e.getValue());
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
@Override
public boolean contains(Object o) {
if (!(o instanceof Entry))
return false;
Entry,?> e = (Entry,?>)o;
Element v = SelectableConcurrentHashMap.this.get(e.getKey());
return v != null && v.equals(e.getValue());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
@Override
public boolean contains(Object o) {
if (!(o instanceof Entry))
return false;
Entry,?> e = (Entry,?>)o;
Element v = SelectableConcurrentHashMap.this.get(e.getKey());
return v != null && v.equals(e.getValue());
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
/**
* Finds the best eviction candidate based on the sampled elements. What distuingishes this approach
* from the classic data structures approach, is that an Element contains metadata which can be used
* for making policy decisions, while generic data structures do not.
*
* @param sampledElements this should be a random subset of the population
* @param justAdded we never want to select the element just added. May be null.
* @return the least hit
*/
public Element selectedBasedOnPolicy(Element[] sampledElements, Element justAdded) {
//edge condition when Memory Store configured to size 0
if (sampledElements.length == 1) {
return sampledElements[0];
}
Element lowestElement = null;
for (Element element : sampledElements) {
if (element == null) {
continue;
}
if (lowestElement == null) {
if (!element.equals(justAdded)) {
lowestElement = element;
}
} else if (compare(lowestElement, element) && !element.equals(justAdded)) {
lowestElement = element;
}
}
return lowestElement;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
/**
* Finds the best eviction candidate based on the sampled elements. What distuingishes this approach
* from the classic data structures approach, is that an Element contains metadata which can be used
* for making policy decisions, while generic data structures do not.
*
* @param sampledElements this should be a random subset of the population
* @param justAdded we never want to select the element just added. May be null.
* @return the least hit
*/
public Element selectedBasedOnPolicy(Element[] sampledElements, Element justAdded) {
//edge condition when Memory Store configured to size 0
if (sampledElements.length == 1) {
return sampledElements[0];
}
Element lowestElement = null;
for (Element element : sampledElements) {
if (element == null) {
continue;
}
if (lowestElement == null) {
if (!element.equals(justAdded)) {
lowestElement = element;
}
} else if (compare(lowestElement, element) && !element.equals(justAdded)) {
lowestElement = element;
}
}
return lowestElement;
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
/**
* Finds the best eviction candidate based on the sampled elements. What distuingishes this approach
* from the classic data structures approach, is that an Element contains metadata which can be used
* for making policy decisions, while generic data structures do not.
*
* @param sampledElements this should be a random subset of the population
* @param justAdded we never want to select the element just added. May be null.
* @return the least hit
*/
public Element selectedBasedOnPolicy(Element[] sampledElements, Element justAdded) {
//edge condition when Memory Store configured to size 0
if (sampledElements.length == 1) {
return sampledElements[0];
}
Element lowestElement = null;
for (Element element : sampledElements) {
if (element == null) {
continue;
}
if (lowestElement == null) {
if (!element.equals(justAdded)) {
lowestElement = element;
}
} else if (compare(lowestElement, element) && !element.equals(justAdded)) {
lowestElement = element;
}
}
return lowestElement;
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
/**
* {@inheritDoc}
*/
public boolean equals(Element e1, Element e2) {
if (e1 == null && e2 == null) {
return true;
} else if (e1 != null && e1.equals(e2)) {
if (e1.getObjectValue() == null) {
return e2.getObjectValue() == null;
} else {
return compareValues(e1.getObjectValue(), e2.getObjectValue());
}
} else {
return false;
}
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
/**
* {@inheritDoc}
*/
public boolean equals(Element e1, Element e2) {
if (e1 == null && e2 == null) {
return true;
} else if (e1 != null && e1.equals(e2)) {
if (e1.getObjectValue() == null) {
return e2.getObjectValue() == null;
} else {
return compareValues(e1.getObjectValue(), e2.getObjectValue());
}
} else {
return false;
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
/**
* {@inheritDoc}
*/
public boolean equals(Element e1, Element e2) {
if (e1 == null && e2 == null) {
return true;
} else if (e1 != null && e1.equals(e2)) {
if (e1.getObjectValue() == null) {
return e2.getObjectValue() == null;
} else {
return compareValues(copyForReadIfNeeded(e1).getObjectValue(), copyForReadIfNeeded(e2).getObjectValue());
}
} else {
return false;
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
boolean containsKey(final Object key, final int hash) {
readLock().lock();
try {
if (count != 0) { // read-volatile
HashEntry e = getFirst(hash);
while (e != null) {
if (e.hash == hash && key.equals(e.key) && !e.value.equals(DUMMY_PINNED_ELEMENT))
return true;
e = e.next;
}
}
return false;
} finally {
readLock().unlock();
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
Element get(final Object key, final int hash) {
readLock().lock();
try {
if (count != 0) { // read-volatile
HashEntry e = getFirst(hash);
while (e != null) {
if (e.hash == hash && key.equals(e.key) && !e.value.equals(DUMMY_PINNED_ELEMENT)) {
e.accessed = true;
return e.value;
}
e = e.next;
}
}
return null;
} finally {
readLock().unlock();
}
}