Codota Logo
PriorityBuffer.remove
Code IndexAdd Codota to your IDE (free)

How to use
remove
method
in
org.apache.commons.collections.buffer.PriorityBuffer

Best Java code snippets using org.apache.commons.collections.buffer.PriorityBuffer.remove (Showing top 8 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
SimpleDateFormat s =
  • Codota IconString pattern;new SimpleDateFormat(pattern)
  • Codota IconString template;Locale locale;new SimpleDateFormat(template, locale)
  • Codota Iconnew SimpleDateFormat()
  • Smart code suggestions by Codota
}
origin: commons-collections/commons-collections

/**
 * Pops all elements from the heap and verifies that the elements come off
 * in the correct order.  NOTE: this method empties the heap.
 */
protected void checkOrder(PriorityBuffer h) {
  Integer lastNum = null;
  Integer num = null;
  while (!h.isEmpty()) {
    num = (Integer) h.remove();
    if (h.ascendingOrder) {
      assertTrue(lastNum == null || num.intValue() >= lastNum.intValue());
    } else { // max heap
      assertTrue(lastNum == null || num.intValue() <= lastNum.intValue());
    }
    lastNum = num;
    num = null;
  }
}

origin: commons-collections/commons-collections

h.remove(new Integer(r));
h.add(new Integer(randGenerator.nextInt(heapSize)));
origin: commons-collections/commons-collections

/**
 * Illustrates bad internal heap state reported in Bugzilla PR #235818. 
 */  
public void testAddRemove() {
  resetEmpty();
  PriorityBuffer heap = (PriorityBuffer) collection;
  heap.add(new Integer(0));
  heap.add(new Integer(2));
  heap.add(new Integer(4));
  heap.add(new Integer(3));
  heap.add(new Integer(8));
  heap.add(new Integer(10));
  heap.add(new Integer(12));
  heap.add(new Integer(3));
  confirmed.addAll(heap);
  // System.out.println(heap);
  Object obj = new Integer(10);
  heap.remove(obj);
  confirmed.remove(obj);
  // System.out.println(heap);
  verify();
}

origin: commons-collections/commons-collections

    "remove using default constructor should return minimum value in the binary heap",
    String.valueOf((char) ('a' + i)),
    heap.remove());
  heap.remove();
  fail("NoSuchElementException should be thrown if remove is called after all elements are removed");
} catch (BufferUnderflowException ex) {}
origin: commons-collections/commons-collections

  heap.remove();
  fail("NoSuchElementException should be thrown if remove is called before any elements are added");
} catch (BufferUnderflowException ex) {}
    "remove using default constructor should return minimum value in the binary heap",
    String.valueOf((char) ('n' - i)),
    heap.remove());
  heap.remove();
  fail("NoSuchElementException should be thrown if remove is called after all elements are removed");
} catch (BufferUnderflowException ex) {}
origin: apache/accumulo

@VisibleForTesting
synchronized boolean next(WritableComparable<?> key, Writable val) throws IOException {
 Index elt = (Index) heap.remove();
 try {
  elt.cache();
  if (elt.cached) {
   copy(elt.key, key);
   copy(elt.value, val);
   elt.cached = false;
  } else {
   return false;
  }
 } finally {
  heap.add(elt);
 }
 return true;
}
origin: org.apache.accumulo/accumulo-tserver

@VisibleForTesting
synchronized boolean next(WritableComparable<?> key, Writable val) throws IOException {
 Index elt = (Index) heap.remove();
 try {
  elt.cache();
  if (elt.cached) {
   copy(elt.key, key);
   copy(elt.value, val);
   elt.cached = false;
  } else {
   return false;
  }
 } finally {
  heap.add(elt);
 }
 return true;
}
origin: org.apache.accumulo/accumulo-server

public synchronized boolean next(WritableComparable key, Writable val) throws IOException {
 Index elt = (Index) heap.remove();
 try {
  elt.cache();
  if (elt.cached) {
   copy(elt.key, key);
   copy(elt.value, val);
   elt.cached = false;
  } else {
   return false;
  }
 } finally {
  heap.add(elt);
 }
 return true;
}
org.apache.commons.collections.bufferPriorityBufferremove

Javadoc

Gets and removes the next element (pop).

Popular methods of PriorityBuffer

  • get
    Gets the next element to be removed without actually removing it (peek).
  • isEmpty
  • compare
    Compares two objects using the comparator if specified, or the natural order otherwise.
  • grow
    Increases the size of the heap to support additional elements
  • isAtCapacity
    Tests if the buffer is at capacity.
  • percolateDownMaxHeap
    Percolates element down heap from the position given by the index. Assumes it is a maximum heap.
  • percolateDownMinHeap
    Percolates element down heap from the position given by the index. Assumes it is a minimum heap.
  • percolateUpMaxHeap
    Percolates a new element up heap from the bottom. Assume it is a maximum heap.
  • percolateUpMinHeap
    Percolates a new element up heap from the bottom. Assumes it is a minimum heap.
  • <init>
    Constructs a new empty buffer specifying the sort order and comparator.
  • add
    Adds an element to the buffer. The element added will be sorted according to the comparator in use.
  • size
    Returns the number of elements in this buffer.
  • add,
  • size,
  • contains,
  • iterator

Popular in Java

  • Updating database using SQL prepared statement
  • putExtra (Intent)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • getExternalFilesDir (Context)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • TimerTask (java.util)
    A task that can be scheduled for one-time or repeated execution by a Timer.
  • TreeMap (java.util)
    A Red-Black tree based NavigableMap implementation. The map is sorted according to the Comparable of
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now