Tabnine Logo
ObjectHashMap.indexOf
Code IndexAdd Tabnine to your IDE (free)

How to use
indexOf
method
in
org.drools.core.util.ObjectHashMap

Best Java code snippets using org.drools.core.util.ObjectHashMap.indexOf (Showing top 4 results out of 315)

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools

public Entry getBucket(final Object object) {
  final int hashCode = this.comparator.hashCodeOf( object );
  final int index = indexOf( hashCode,
                this.table.length );
  return this.table[index];
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools

public Object get(final Object key) {
  final int hashCode = this.comparator.hashCodeOf( key );
  final int index = indexOf( hashCode,
                this.table.length );
  ObjectEntry current = (ObjectEntry) this.table[index];
  while ( current != null ) {
    if ( hashCode == current.cachedHashCode && this.comparator.equal( key,
                                  current.key ) ) {
      return current.value;
    }
    current = (ObjectEntry) current.getNext();
  }
  return null;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools

public Object remove(final Object key) {
  final int hashCode = this.comparator.hashCodeOf( key );
  final int index = indexOf( hashCode,
                this.table.length );
  ObjectEntry previous = (ObjectEntry) this.table[index];
  ObjectEntry current = previous;
  while ( current != null ) {
    final ObjectEntry next = (ObjectEntry) current.getNext();
    if ( hashCode == current.cachedHashCode && this.comparator.equal( key,
                                  current.key ) ) {
      if ( previous == current ) {
        this.table[index] = next;
      } else {
        previous.setNext( next );
      }
      current.setNext( null );
      this.size--;
      return current.value;
    }
    previous = current;
    current = next;
  }
  return null;
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.drools

public Object put(final Object key,
         final Object value,
         final boolean checkExists) {
  final int hashCode = this.comparator.hashCodeOf( key );
  final int index = indexOf( hashCode,
                this.table.length );
  // scan the linked entries to see if it exists
  if ( checkExists ) {
    ObjectEntry current = (ObjectEntry) this.table[index];
    while ( current != null ) {
      if ( hashCode == current.cachedHashCode && this.comparator.equal( key,
                                    current.key ) ) {
        final Object oldValue = current.value;
        current.value = value;
        return oldValue;
      }
      current = (ObjectEntry) current.getNext();
    }
  }
  // We aren't checking the key exists, or it didn't find the key
  final ObjectEntry entry = new ObjectEntry( key,
                        value,
                        hashCode );
  entry.next = this.table[index];
  this.table[index] = entry;
  if ( this.size++ >= this.threshold ) {
    resize( 2 * this.table.length );
  }
  return null;
}
org.drools.core.utilObjectHashMapindexOf

Popular methods of ObjectHashMap

  • iterator
  • size
  • <init>
  • get
  • isEmpty
  • put
  • clear
  • newIterator
  • remove
  • resize
  • setComparator
  • setComparator

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • onCreateOptionsMenu (Activity)
  • getApplicationContext (Context)
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Reference (javax.naming)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now