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

How to use
Callbacks
in
com.nesscomputing.callback

Best Java code snippets using com.nesscomputing.callback.Callbacks (Showing top 3 results out of 315)

origin: com.nesscomputing.components/ness-core

/**
 * For every element, invoke the given callback.
 * Stops if {@link CallbackRefusedException} is thrown.
 */
@SafeVarargs
public static <T> void stream(Callback<T> callback, T... items) throws Exception
{
  stream(callback, Arrays.asList(items));
}
origin: com.nesscomputing.components/ness-core

/**
 * Combine multiple callbacks into a single callback, preserving order.
 */
@SafeVarargs
public static <T> Callback<T> chain(Callback<T>... callbacks)
{
  return chain(Arrays.asList(callbacks));
}
origin: com.nesscomputing.components/ness-core

  @Test
  public void testCallbackRefused() throws Exception
  {
    final List<Collection<String>> items = Lists.newArrayList();
    Callback<Collection<String>> callback = new Callback<Collection<String>>() {
      @Override
      public void call(Collection<String> item) throws Exception
      {
        if (items.size() > 1) {
          throw new CallbackRefusedException();
        }
        items.add(item);
      }
    };

    try (BatchingCallback<String> batcher = BatchingCallback.<String>batchInto(2, callback)) {
      Callbacks.stream(batcher, "a", "b", "c", "d", "e", "f", "g");
    }

    assertEquals(of(
        of("a", "b"),
        of("c", "d")
      ), items);
  }
}
com.nesscomputing.callbackCallbacks

Javadoc

Callback helper methods

Most used methods

  • stream
    For every element, invoke the given callback. Stops if CallbackRefusedException is thrown.
  • chain
    Combine multiple callbacks into a single callback, preserving order.

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • compareTo (BigDecimal)
  • findViewById (Activity)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Path (java.nio.file)
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • JCheckBox (javax.swing)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Best IntelliJ 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