Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.attribyte.essem.sysmon.linux;
 
 
 import java.util.Set;
 
 public interface KeyFilter {

   
Should the name be accepted?

Returns:
The name.
   public boolean accept(final String str);

   
A filter that accepts only names in a set.
   public static class AcceptSet implements KeyFilter {

      
Creates the filter.

Parameters:
allowed The allowed names.
      public AcceptSet(final Set<Stringallowed) {
         this. = ImmutableSet.copyOf(allowed);
      }
      @Override
      public boolean accept(final String str) {
         return .contains(str);
      }
      private final ImmutableSet<Stringallowed;
   }

   
Accepts all keys.
   public static KeyFilter acceptAll = new KeyFilter() {
      @Override
      public boolean accept(final String str) {
         return true;
      }
   };

   
Accepts no keys.
   public static KeyFilter acceptNone = new KeyFilter() {
      @Override
      public boolean accept(final String str) {
         return false;
      }
   };
New to GrepCode? Check out our FAQ X