本文整理了Java中com.google.common.collect.MinMaxPriorityQueue.elementData()
方法的一些代码示例,展示了MinMaxPriorityQueue.elementData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MinMaxPriorityQueue.elementData()
方法的具体详情如下:
包路径:com.google.common.collect.MinMaxPriorityQueue
类名称:MinMaxPriorityQueue
方法名:elementData
暂无
代码示例来源:origin: google/guava
/** Removes and returns the value at {@code index}. */
private E removeAndGet(int index) {
E value = elementData(index);
removeAt(index);
return value;
}
代码示例来源:origin: google/guava
@Override
public E peek() {
return isEmpty() ? null : elementData(0);
}
代码示例来源:origin: google/j2objc
/** Removes and returns the value at {@code index}. */
private E removeAndGet(int index) {
E value = elementData(index);
removeAt(index);
return value;
}
代码示例来源:origin: google/j2objc
@Override
public E peek() {
return isEmpty() ? null : elementData(0);
}
代码示例来源:origin: google/guava
/**
* Retrieves, but does not remove, the greatest element of this queue, or returns {@code null} if
* the queue is empty.
*/
public E peekLast() {
return isEmpty() ? null : elementData(getMaxElementIndex());
}
代码示例来源:origin: wildfly/wildfly
/** Removes and returns the value at {@code index}. */
private E removeAndGet(int index) {
E value = elementData(index);
removeAt(index);
return value;
}
代码示例来源:origin: wildfly/wildfly
@Override
public E peek() {
return isEmpty() ? null : elementData(0);
}
代码示例来源:origin: google/j2objc
/**
* Retrieves, but does not remove, the greatest element of this queue, or returns {@code null} if
* the queue is empty.
*/
public E peekLast() {
return isEmpty() ? null : elementData(getMaxElementIndex());
}
代码示例来源:origin: wildfly/wildfly
/**
* Retrieves, but does not remove, the greatest element of this queue, or returns {@code null} if
* the queue is empty.
*/
public E peekLast() {
return isEmpty() ? null : elementData(getMaxElementIndex());
}
代码示例来源:origin: google/guava
return null;
E actualLastElement = elementData(size);
int lastElementAt = heapForIndex(size).swapWithConceptuallyLastElement(actualLastElement);
if (lastElementAt == index) {
return null;
E toTrickle = elementData(size);
queue[size] = null;
MoveDesc<E> changes = fillHole(index, toTrickle);
代码示例来源:origin: google/guava
private MoveDesc<E> fillHole(int index, E toTrickle) {
Heap heap = heapForIndex(index);
// We consider elementData(index) a "hole", and we want to fill it
// with the last element of the heap, toTrickle.
// Since the last element of the heap is from the bottom level, we
// optimistically fill index position with elements from lower levels,
// moving the hole down. In most cases this reduces the number of
// comparisons with toTrickle, but in some cases we will need to bubble it
// all the way up again.
int vacated = heap.fillHoleAt(index);
// Try to see if toTrickle can be bubbled up min levels.
int bubbledTo = heap.bubbleUpAlternatingLevels(vacated, toTrickle);
if (bubbledTo == vacated) {
// Could not bubble toTrickle up min levels, try moving
// it from min level to max level (or max to min level) and bubble up
// there.
return heap.tryCrossOverAndBubbleUp(index, vacated, toTrickle);
} else {
return (bubbledTo < index) ? new MoveDesc<E>(toTrickle, elementData(index)) : null;
}
}
代码示例来源:origin: google/j2objc
return null;
E actualLastElement = elementData(size);
int lastElementAt = heapForIndex(size).swapWithConceptuallyLastElement(actualLastElement);
if (lastElementAt == index) {
return null;
E toTrickle = elementData(size);
queue[size] = null;
MoveDesc<E> changes = fillHole(index, toTrickle);
代码示例来源:origin: google/j2objc
private MoveDesc<E> fillHole(int index, E toTrickle) {
Heap heap = heapForIndex(index);
// We consider elementData(index) a "hole", and we want to fill it
// with the last element of the heap, toTrickle.
// Since the last element of the heap is from the bottom level, we
// optimistically fill index position with elements from lower levels,
// moving the hole down. In most cases this reduces the number of
// comparisons with toTrickle, but in some cases we will need to bubble it
// all the way up again.
int vacated = heap.fillHoleAt(index);
// Try to see if toTrickle can be bubbled up min levels.
int bubbledTo = heap.bubbleUpAlternatingLevels(vacated, toTrickle);
if (bubbledTo == vacated) {
// Could not bubble toTrickle up min levels, try moving
// it from min level to max level (or max to min level) and bubble up
// there.
return heap.tryCrossOverAndBubbleUp(index, vacated, toTrickle);
} else {
return (bubbledTo < index) ? new MoveDesc<E>(toTrickle, elementData(index)) : null;
}
}
代码示例来源:origin: wildfly/wildfly
return null;
E actualLastElement = elementData(size);
int lastElementAt = heapForIndex(size).swapWithConceptuallyLastElement(actualLastElement);
if (lastElementAt == index) {
return null;
E toTrickle = elementData(size);
queue[size] = null;
MoveDesc<E> changes = fillHole(index, toTrickle);
代码示例来源:origin: wildfly/wildfly
private MoveDesc<E> fillHole(int index, E toTrickle) {
Heap heap = heapForIndex(index);
// We consider elementData(index) a "hole", and we want to fill it
// with the last element of the heap, toTrickle.
// Since the last element of the heap is from the bottom level, we
// optimistically fill index position with elements from lower levels,
// moving the hole down. In most cases this reduces the number of
// comparisons with toTrickle, but in some cases we will need to bubble it
// all the way up again.
int vacated = heap.fillHoleAt(index);
// Try to see if toTrickle can be bubbled up min levels.
int bubbledTo = heap.bubbleUpAlternatingLevels(vacated, toTrickle);
if (bubbledTo == vacated) {
// Could not bubble toTrickle up min levels, try moving
// it from min level to max level (or max to min level) and bubble up
// there.
return heap.tryCrossOverAndBubbleUp(index, vacated, toTrickle);
} else {
return (bubbledTo < index) ? new MoveDesc<E>(toTrickle, elementData(index)) : null;
}
}
代码示例来源:origin: Nextdoor/bender
/**
* Removes and returns the value at {@code index}.
*/
private E removeAndGet(int index) {
E value = elementData(index);
removeAt(index);
return value;
}
代码示例来源:origin: com.diffplug.guava/guava-collect
/**
* Removes and returns the value at {@code index}.
*/
private E removeAndGet(int index) {
E value = elementData(index);
removeAt(index);
return value;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/**
* Removes and returns the value at {@code index}.
*/
private E removeAndGet(int index) {
E value = elementData(index);
removeAt(index);
return value;
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/**
* Retrieves, but does not remove, the greatest element of this queue, or returns {@code null} if
* the queue is empty.
*/
public E peekLast() {
return isEmpty() ? null : elementData(getMaxElementIndex());
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Retrieves, but does not remove, the greatest element of this queue, or
* returns {@code null} if the queue is empty.
*/
public E peekLast() {
return isEmpty() ? null : elementData(getMaxElementIndex());
}
内容来源于网络,如有侵权,请联系作者删除!