Codota Logo
SortedArrayList.get
Code IndexAdd Codota to your IDE (free)

How to use
get
method
in
jodd.util.collection.SortedArrayList

Best Java code snippets using jodd.util.collection.SortedArrayList.get (Showing top 12 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
origin: redisson/redisson

/**
 * Conducts a binary search to find the index where Object
 * should be inserted.
 */
protected int findInsertionPoint(E o, int low, int high) {
  while (low <= high) {
    int mid = (low + high) >>> 1;
    int delta = compare(get(mid), o);
    if (delta > 0) {
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  return low;
}
origin: oblac/jodd

  @Test
  void testComparator(){
    Comparator<String> comparator = new Comparator<String>() {
      @Override
      public int compare(String str1, String str2) {
        if (str1 == null && str2 == null) {
          return 0;
        }
        if (str1 == null) {
          return 1;
        }
        if (str2 == null) {
          return -1;
        }
        return str2.compareTo(str1);
      }
    };
    SortedArrayList<String> list = new SortedArrayList<>(comparator);
    assertNotNull(list.getComparator());
    list.add("aaa");
    list.add("bbb");
    assertEquals(2, list.size());
    assertEquals("bbb", list.get(0));
    assertEquals("aaa", list.get(1));
    
  }
}
origin: oblac/jodd

/**
 * Conducts a binary search to find the index where Object
 * should be inserted.
 */
protected int findInsertionPoint(final E o, int low, int high) {
  while (low <= high) {
    int mid = (low + high) >>> 1;
    int delta = compare(get(mid), o);
    if (delta > 0) {
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  return low;
}
origin: oblac/jodd

@Test
void testRandom() {
  int total = 100000;
  ArrayList<String> randomList = new ArrayList<>();
  for (int i = 0; i < total; i++) {
    randomList.add(RandomString.get().random(20, 'a', 'z'));
  }
  SortedArrayList<String> sortedList = new SortedArrayList<>(randomList);
  Collections.sort(randomList);
  for (int i = 0; i < total; i++) {
    assertEquals(randomList.get(i), sortedList.get(i));
  }
}

origin: oblac/jodd

@Test
void testList2() {
  SortedArrayList<String> list = new SortedArrayList<>();
  list.add("bbb");
  list.add("aaa");
  assertEquals(2, list.size());
  assertEquals("aaa", list.get(0));
  assertEquals("bbb", list.get(1));
  list.add("aa");
  assertEquals(3, list.size());
  assertEquals("aa", list.get(0));
  list.add("a");
  assertEquals(4, list.size());
  assertEquals("a", list.get(0));
  assertEquals(1, list.findInsertionPoint("a"));
}
origin: oblac/jodd

assertEquals("aaa", list.get(0));
assertEquals("bbb", list.get(1));
assertEquals("ccc", list.get(2));
assertEquals("cc", list.get(2));
origin: org.jodd/jodd-wot

/**
 * Returns chunk <code>deep</code> of a path at <code>index</code>.
 */
protected String get(int index, int deep) {
  return list.get(index).actionPathChunks[deep];
}
origin: org.jodd/jodd-core

/**
 * Conducts a binary search to find the index where Object
 * should be inserted.
 */
protected int findInsertionPoint(final E o, int low, int high) {
  while (low <= high) {
    int mid = (low + high) >>> 1;
    int delta = compare(get(mid), o);
    if (delta > 0) {
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  return low;
}
origin: fivesmallq/web-data-extractor

/**
 * Conducts a binary search to find the index where Object
 * should be inserted.
 */
protected int findInsertionPoint(E o, int low, int high) {
  while (low <= high) {
    int mid = (low + high) >>> 1;
    int delta = compare(get(mid), o);
    if (delta > 0) {
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  return low;
}
origin: org.jodd/jodd-wot

protected int matchChunk(String chunk, int chunkNdx, int macroNdx, int low, int high) {
  for (int i = low; i <= high; i++) {
    ActionConfigSet set = list.get(i);
    // check if there is a macro on this chunk position
    if (macroNdx >= set.actionPathMacros.length) {
      continue;
    }
    ActionConfigSet.PathMacro macro = set.actionPathMacros[macroNdx];
    if (macro.ndx != chunkNdx) {
      continue;
    }
    // match macro
    if (chunk.startsWith(macro.left) == false) {
      continue;
    }
    if (chunk.endsWith(macro.right) == false) {
      continue;
    }
    // match value
    if (macro.pattern != null) {
      String value = chunk.substring(macro.left.length(), chunk.length() - macro.right.length());
      if (macro.pattern.matcher(value).matches() == false) {
        continue;
      }
    }
    // macro found
    return i;
  }
  return -1;
}
origin: org.jodd/jodd-wot

  list.add(set);
} else {
  set = list.get(ndx);
origin: org.jodd/jodd-wot

ActionConfigSet set = list.get(low);
ActionConfig cfg = set.lookup(method);
jodd.util.collectionSortedArrayListget

Javadoc

Returns comparator assigned to this collection, if such exist.

Popular methods of SortedArrayList

  • add
    Adds an Object to sorted list. Object is inserted at correct place, found using binary search. If th
  • size
  • addAll
    Add all of the elements in the given collection to this list.
  • findInsertionPoint
    Conducts a binary search to find the index where Object should be inserted.
  • compare
    Compares two keys using the correct comparison method for this collection.
  • isEmpty
  • <init>
    Constructs a new SortedArrayList.
  • getComparator
    Returns comparator assigned to this collection, if such exist.
  • set

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • getApplicationContext (Context)
  • findViewById (Activity)
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • JLabel (javax.swing)
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