@Test public void testOrElseChainMultiple() { Collection<SimpleTransformation> transformations = ImmutableList.of( new SimpleTransformation(FalseExpr.INSTANCE, Noop.NOOP_DEST_NAT), new SimpleTransformation(FalseExpr.INSTANCE, Noop.NOOP_SOURCE_NAT), new SimpleTransformation(TrueExpr.INSTANCE, Noop.NOOP_SOURCE_NAT)); assertThat( orElseChain(transformations), equalTo( Transformation.when(TrueExpr.INSTANCE) .apply(Noop.NOOP_SOURCE_NAT) .setOrElse( Transformation.when(FalseExpr.INSTANCE) .apply(Noop.NOOP_SOURCE_NAT) .setOrElse( Transformation.when(FalseExpr.INSTANCE) .apply(Noop.NOOP_DEST_NAT) .build()) .build()) .build())); }
public static @Nullable Transformation orElseChain( Iterable<SimpleTransformation> simpleTransformations) { Transformation current = null; for (SimpleTransformation earlier : simpleTransformations) { current = Transformation.when(earlier.getGuard()) .apply(earlier.getStep()) .setOrElse(current) .build(); } return current; }
F5NatUtil { public static @Nullable Transformation orElseChain( Iterable<SimpleTransformation> simpleTransformations) { Transformation current = null; for (SimpleTransformation earlier : simpleTransformations) { current = Transformation.when(earlier.getGuard()) .apply(earlier.getStep()) .setOrElse(current) .build(); } return current; } }
F5NatUtil { public static @Nullable Transformation orElseChain( Iterable<SimpleTransformation> simpleTransformations) { Transformation current = null; for (SimpleTransformation earlier : simpleTransformations) { current = Transformation.when(earlier.getGuard()) .apply(earlier.getStep()) .setOrElse(current) .build(); } return current; } private  F5NatUtil(); }
F5NatUtil { public static @Nullable Transformation orElseChain( Iterable<SimpleTransformation> simpleTransformations) { Transformation current = null; for (SimpleTransformation earlier : simpleTransformations) { current = Transformation.when(earlier.getGuard()) .apply(earlier.getStep()) .setOrElse(current) .build(); } return current; } private  F5NatUtil(); static @Nullable Transformation orElseChain(
      Iterable<SimpleTransformation> simpleTransformations); }
F5NatUtil { public static @Nullable Transformation orElseChain( Iterable<SimpleTransformation> simpleTransformations) { Transformation current = null; for (SimpleTransformation earlier : simpleTransformations) { current = Transformation.when(earlier.getGuard()) .apply(earlier.getStep()) .setOrElse(current) .build(); } return current; } private  F5NatUtil(); static @Nullable Transformation orElseChain(
      Iterable<SimpleTransformation> simpleTransformations);  }