Guava FluentIterable - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava FluentIterable class.

This code example shows how to use the following methods:allMatch, first, size
 
	public Method findMethod(List<Method> interceptorMethods, Class<? extends Annotation> step, Class<?> interceptorClass) {
 
		FluentIterable<Method> possibleMethods = FluentIterable.from(interceptorMethods).filter(hasStepAnnotation(step));
 
		if (possibleMethods.size() > 1 && possibleMethods.allMatch(not(notSameClass(interceptorClass)))) {
			throw new IllegalStateException(String.format("%s - You should not have more than one @%s annotated method",
					interceptorClass.getCanonicalName(), step.getSimpleName()));
		} 
 
		return possibleMethods.first().orNull();
	} 
 
	private Predicate<Method> notSameClass(final Class<?> interceptorClass) {
		return new Predicate<Method>() {
			@Override 
			public boolean apply(Method possibleMethod) {
				return !possibleMethod.getDeclaringClass().equals(interceptorClass);
			} 
		}; 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:toSet
      FluentIterable<Task> expected = expected();
 
      TaskListHandler handler = injector.getInstance(TaskListHandler.class);
      FluentIterable<Task> result = factory.create(handler).parse(is);
 
      assertEquals(result.toSet().toString(), expected.toSet().toString());
   } 
 
   public FluentIterable<Task> expected() {
      return FluentIterable.from(ImmutableSet.<Task> builder()
                           .add(Task.builder() 
                                    .guid("0b40c7dd-748d-4c49-8506-26f0c7d2ea9c") 
                                    .statusCode(StatusCode.COMPLETE) 
                                    .message("Processing complete") 
                                    .resultUrl(URI.create("http://localhost:8008/users/node01/tasks/0b40c7dd-748d-4c49-8506-26f0c7d2ea9c/result"))
                                    .build()) 
                           .build()); 
   } 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:transform
 * Zones, Geo Services, and Geo region groups come back encoded in REST paths, such as 
 * {@code /REST/Geo/srv-global/} 
 */ 
public final class ExtractLastPathComponent implements Function<FluentIterable<String>, FluentIterable<String>> {
   public FluentIterable<String> apply(FluentIterable<String> in) {
      return in.transform(ExtractNameInPath.INSTANCE);
   } 
 
   static enum ExtractNameInPath implements Function<String, String> {
      INSTANCE;
      public static final Pattern DEFAULT_PATTERN = Pattern.compile("/REST.*/([^/]+)/?$");
 
      public String apply(String in) {
         Matcher matcher = DEFAULT_PATTERN.matcher(in);
         checkState(matcher.find() && matcher.groupCount() == 1, "%s didn't match %s", in, DEFAULT_PATTERN);
         return matcher.group(1);
      } 
   } 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:toSet
      FluentIterable<DirectionalPool> expected = expected();
 
      DirectionalPoolListHandler handler = injector.getInstance(DirectionalPoolListHandler.class);
      FluentIterable<DirectionalPool> result = factory.create(handler).parse(is);
 
      assertEquals(result.toSet().toString(), expected.toSet().toString());
   } 
 
   public FluentIterable<DirectionalPool> expected() {
      return FluentIterable.from(ImmutableList.<DirectionalPool> builder()
                           .add(DirectionalPool.builder() 
                                               .zoneId("0000000000000001") 
                                               .id("000000000000000A") 
                                               .dname("mixy.jclouds.org.") 
                                               .type(Type.MIXED) 
                                               .tieBreak(TieBreak.GEOLOCATION) 
                                               .name("mixy").build()) 
                           .add(DirectionalPool.builder() 
                                               .zoneId("0000000000000002") 
                                               .id("000000000000000B") 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:toSet
      FluentIterable<AccountLevelGroup> expected = expected();
 
      AccountLevelGroupsHandler handler = injector.getInstance(AccountLevelGroupsHandler.class);
      FluentIterable<AccountLevelGroup> result = factory.create(handler).parse(is);
 
      assertEquals(result.toSet().toString(), expected.toSet().toString());
   } 
 
   public FluentIterable<AccountLevelGroup> expected() {
      return FluentIterable.from(ImmutableList.<AccountLevelGroup> builder()
                           .add(AccountLevelGroup.builder() 
                                                 .id("000000000000000A") 
                                                 .name("ASIA") 
                                                 .type(Type.GEOLOCATION) 
                                                 .recordCount(0).build()) 
                           .add(AccountLevelGroup.builder() 
                                                 .id("000000000000000B") 
                                                 .name("EU") 
                                                 .type(Type.GEOLOCATION) 
                                                 .recordCount(3).build()) 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:toString
        FluentIterable<Subnet> expected = expected();
         
        DescribeSubnetsResponseHandler handler = injector.getInstance(DescribeSubnetsResponseHandler.class);
        FluentIterable<Subnet> result = factory.create(handler).parse(is);
         
        assertEquals(result.toString(), expected.toString());
         
    } 
    public FluentIterable<Subnet> expected() {
        return FluentIterable.from(ImmutableSet.<Subnet>builder()
                                   .add(Subnet.builder() 
                                        .subnetId("subnet-9d4a7b6c") 
                                        .subnetState(Subnet.State.AVAILABLE) 
                                        .vpcId("vpc-1a2b3c4d") 
                                        .cidrBlock("10.0.1.0/24") 
                                        .availableIpAddressCount(250) 
                                        .availabilityZone("us-east-1a") 
                                        .tag("Name", "ec2-o") 
                                        .tag("Empty", "") 
                                        .build())                 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:from
      } 
   } 
 
   @Override 
   public FluentIterable<Alarm> getResult() {
      FluentIterable<Alarm> result = FluentIterable.from(alarms);
 
      alarms = Sets.newLinkedHashSet();
 
      return result;
   } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:toSet
      FluentIterable<Zone> expected = expected();
 
      ZoneListHandler handler = injector.getInstance(ZoneListHandler.class);
      FluentIterable<Zone> result = factory.create(handler).parse(is);
 
      assertEquals(result.toSet().toString(), expected.toSet().toString());
   } 
 
   public FluentIterable<Zone> expected() {
      return FluentIterable.from(ImmutableSet.<Zone> builder()
                           .add(Zone.builder() 
                                    .name("jclouds.org.") 
                                    .typeCode(1) 
                                    .accountId("AAAAAAAAAAAAAAAA") 
                                    .ownerId("EEEEEEEEEEEEEEEE") 
                                    .id("0000000000000001") 
                                    .dnssecStatus(DNSSECStatus.UNSIGNED).build()) 
                           .add(Zone.builder() 
                                    .name("0.1.2.3.4.5.6.7.ip6.arpa.") 
                                    .typeCode(1) 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:from
      .add(builder.guid("0B0338C2023F796A")
                  .created(dateService.iso8601DateParse("2009-10-12T12:02:23.000Z"))
                  .modified(dateService.iso8601DateParse("2009-10-12T12:02:23.000Z"))
                  .record(rrBuilder().type(2).name("jclouds.org.").ttl(86400).rdata("pdns3.ultradns.org.")).build()) 
      .build(); 
      return FluentIterable.from(records);
   } 
 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:toSet
      FluentIterable<TrafficControllerPoolRecordDetail> expected = expected();
 
      TrafficControllerPoolRecordDetailListHandler handler = injector.getInstance(TrafficControllerPoolRecordDetailListHandler.class);
      FluentIterable<TrafficControllerPoolRecordDetail> result = factory.create(handler).parse(is);
 
      assertEquals(result.toSet().toString(), expected.toSet().toString());
   } 
 
   public FluentIterable<TrafficControllerPoolRecordDetail> expected() {
      return FluentIterable.from(ImmutableSet.<TrafficControllerPoolRecordDetail> builder()
                           .add(TrafficControllerPoolRecordDetail.builder() 
                                                           .id("0000000000000001") 
                                                           .poolId("0000000000000001") 
                                                           .record(createCNAME("canary.jclouds.org.")) 
                                                           .weight(2) 
                                                           .priority(2) 
                                                           .forceAnswer("Normal") 
                                                           .probingEnabled(true) 
                                                           .status(OK) 
                                                           .serving(true) 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Guava FluentIterable Methods: