Tabnine Logo
SelectionModel
Code IndexAdd Tabnine to your IDE (free)

How to use
SelectionModel
in
cc.lasmgratel.foodcraftreloaded.api.util.selection

Best Java code snippets using cc.lasmgratel.foodcraftreloaded.api.util.selection.SelectionModel (Showing top 3 results out of 315)

origin: NanamiArihara/FoodCraft-Reloaded

  static <T extends NamedProperty> SelectionModel<T> createSelectionFrom(Stream<T> stream) {
    return new SelectionModel<>(stream);
  }
}
origin: NanamiArihara/FoodCraft-Reloaded

@Test
public void testFilter() {
  assertTrue(
    Selector.wrap("ironIngot", "ironPlate", "ironStick", "bronzeIngot", "bronzeStick")
      .filter("Siron")
      .stream()
      .allMatch(s -> s.getName().startsWith("iron"))
  );
}
origin: NanamiArihara/FoodCraft-Reloaded

/**
 * Using custom pattern.
 * Modes are switched by the first letter.
 * R for Regex
 * S for StartsWith
 * E for EndsWith
 * Q or any other letter for Equals
 * C for Contains
 */
public SelectionModel<T> filter(String pattern) {
  return filter(s -> {
    if (s.isEmpty())
      return false;
    char firstChar = pattern.charAt(0);
    switch (firstChar) {
      case 'R':
        return SelectPredicates.REGEX.test(s, pattern.substring(1));
      case 'S':
        return SelectPredicates.STARTS.test(s, pattern.substring(1));
      case 'E':
        return SelectPredicates.ENDS.test(s, pattern.substring(1));
      case 'Q':
        return SelectPredicates.EQUAL.test(s, pattern.substring(1));
      case 'C':
        return SelectPredicates.CONTAINS.test(s, pattern.substring(1));
      default:
        return SelectPredicates.EQUAL.test(s, pattern);
    }
  });
}
cc.lasmgratel.foodcraftreloaded.api.util.selectionSelectionModel

Most used methods

  • filter
  • <init>
  • stream

Popular in Java

  • Reactive rest calls using spring rest template
  • addToBackStack (FragmentTransaction)
  • setContentView (Activity)
  • startActivity (Activity)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Top Vim plugins
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