Tabnine Logo
KBucketSet.getClosest
Code IndexAdd Tabnine to your IDE (free)

How to use
getClosest
method
in
net.i2p.kademlia.KBucketSet

Best Java code snippets using net.i2p.kademlia.KBucketSet.getClosest (Showing top 5 results out of 315)

origin: i2p/i2p.i2p

/**
 *  The keys closest to the key.
 *  Returned list will never contain us.
 *  @return non-null, closest first
 */
public List<T> getClosest(T key, int max) {
  return getClosest(key, max, Collections.<T> emptySet());
}

origin: i2p/i2p.i2p

/**
 *  The keys closest to us.
 *  Returned list will never contain us.
 *  @return non-null, closest first
 */
public List<T> getClosest(int max) {
  return getClosest(max, Collections.<T> emptySet());
}

origin: i2p/i2p.i2p

/**
 *  DHT
 *  @param h either a InfoHash or a NID
 */
public List<NodeInfo> findClosest(SHA1Hash h, int numWant) {
  NID key;
  if (h instanceof NID)
    key = (NID) h;
  else
    key = new NID(h.getData());
  List<NID> keys = _kad.getClosest(key, numWant);
  List<NodeInfo> rv = new ArrayList<NodeInfo>(keys.size());
  for (NID nid : keys) {
    NodeInfo ninfo = _nodeMap.get(nid);
    if (ninfo != null)
      rv.add(ninfo);
  }
  return rv;
}
origin: i2p/i2p.i2p

  return getClosest(max, toIgnore);
List<T> rv = new ArrayList<T>(max);
int count = 0;
origin: i2p/i2p.i2p

  /** @since 0.9.10 */
  public void testClosest() {
    byte val[] = new byte[Hash.HASH_LENGTH];
    for (int i = 0; i < 23; i++) {
      context.random().nextBytes(val);
      Hash h = new Hash(val);
      List<Hash> c = set.getClosest(h, i);
      assertTrue(c.size() == i);
    }
  }
}
net.i2p.kademliaKBucketSetgetClosest

Javadoc

The keys closest to us. Returned list will never contain us.

Popular methods of KBucketSet

  • <init>
    Use the supplied trim strategy.
  • add
  • getExploreKeys
    For every bucket that hasn't been updated in this long, or isn't close to full, generate a random ke
  • toString
  • clear
  • generateRandomKey
    Generate a random key to go within this bucket Package private for testing only. Others shouldn't ne
  • getAll
  • getRange
    The number of bits minus 1 (range number) for the xor of the key. Package private for testing only.
  • remove
  • size
    The current number of entries.
  • createBucket
  • createBuckets
  • createBucket,
  • createBuckets,
  • getBucket,
  • getBuckets,
  • getReadLock,
  • getWriteLock,
  • locked_split,
  • makeKey,
  • pickBucket

Popular in Java

  • Making http requests using okhttp
  • setContentView (Activity)
  • addToBackStack (FragmentTransaction)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Menu (java.awt)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • JOptionPane (javax.swing)
  • Join (org.hibernate.mapping)
  • Github Copilot 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