Tabnine Logo
FunctionalIterable.filter
Code IndexAdd Tabnine to your IDE (free)

How to use
filter
method
in
org.apache.druid.java.util.common.guava.FunctionalIterable

Best Java code snippets using org.apache.druid.java.util.common.guava.FunctionalIterable.filter (Showing top 2 results out of 315)

origin: apache/incubator-druid

private Iterable<BytesMessageWithOffset> filterAndDecode(Iterable<MessageAndOffset> kafkaMessages, final long offset)
{
 return FunctionalIterable
   .create(kafkaMessages)
   .filter(
     new Predicate<MessageAndOffset>()
     {
      @Override
      public boolean apply(MessageAndOffset msgAndOffset)
      {
       return msgAndOffset.offset() >= offset;
      }
     }
   )
   .transform(
     new Function<MessageAndOffset, BytesMessageWithOffset>()
     {
      @Override
      public BytesMessageWithOffset apply(MessageAndOffset msgAndOffset)
      {
       ByteBuffer bb = msgAndOffset.message().payload();
       byte[] payload = new byte[bb.remaining()];
       bb.get(payload);
       // add nextOffset here, thus next fetch will use nextOffset instead of current offset
       return new BytesMessageWithOffset(payload, msgAndOffset.nextOffset(), partitionId);
      }
     }
   );
}
origin: apache/incubator-druid

@Test
public void testFilter()
{
 Assert.assertEquals(
   Lists.newArrayList(
     FunctionalIterable.create(Arrays.asList("1", "2", "3"))
              .filter(
                new Predicate<String>()
                {
                 @Override
                 public boolean apply(String input)
                 {
                  return !"2".equals(input);
                 }
                }
              )
   ),
   Arrays.asList("1", "3")
 );
}
org.apache.druid.java.util.common.guavaFunctionalIterablefilter

Popular methods of FunctionalIterable

  • create
  • transform
  • transformCat
  • <init>
  • drop
  • keep
  • limit
  • trinaryTransform

Popular in Java

  • Creating JSON documents from java classes using gson
  • scheduleAtFixedRate (Timer)
  • getContentResolver (Context)
  • compareTo (BigDecimal)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • JList (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • From CI to AI: The AI layer in your organization
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