private static boolean isExpired(final Tuple2<Loan, Instant> p) { final Instant now = DateUtil.now(); final Instant expiration = p._2().plus(EVICT_AFTER); return expiration.isBefore(now); }
private static boolean isExpired(final Tuple2<Loan, Instant> p) { final Instant now = DateUtil.now(); final Instant expiration = p._2().plus(EVICT_AFTER); return expiration.isBefore(now); }
public Card dealOneCard(List<Card> stack) { Tuple2<Card, ? extends List<Card>> cardTuple2 = stack.pop2(); stack = cardTuple2._2(); return cardTuple2._1(); }
public Card dealOneCard(List<Card> stack) { Tuple2<Card, List<Card>> cardTuple2 = stack.pop2(); stack = cardTuple2._2(); return cardTuple2._1(); }
public List<Set<Card>> dealHands(List<Card> shuffled, int hands, int cardsPerHand) { List<Set<Card>> list = List.empty(); for (int i = 0; i < hands; i++) { Tuple2<Set<Card>, List<Card>> tuple2 = this.deal(shuffled, cardsPerHand); shuffled = tuple2._2(); list = list.append(tuple2._1()); } return list; }
public List<Set<Card>> dealHands( List<Card> shuffled, int hands, int cardsPerHand) { List<Set<Card>> list = List.empty(); for (int i = 0; i < hands; i++) { Tuple2<Set<Card>, ? extends List<Card>> tuple2 = this.deal(shuffled, cardsPerHand); shuffled = tuple2._2(); list = list.append(tuple2._1()); } return list; }
public Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count) { var hand = HashSet.<Card>empty(); for (int i = 0; i < count; i++) { var cardTuple2 = stack.pop2(); stack = cardTuple2._2(); hand = hand.add(cardTuple2._1()); } return Tuple.of(hand, stack); }
public Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count) { Set<Card> hand = HashSet.empty(); for (int i = 0; i < count; i++) { Tuple2<Card, ? extends List<Card>> cardTuple2 = stack.pop2(); stack = cardTuple2._2(); hand = hand.add(cardTuple2._1()); } return Tuple.of(hand, stack); }
public Tuple2<Set<Card>, List<Card>> deal(List<Card> stack, int count) { Set<Card> hand = HashSet.empty(); for (int i = 0; i < count; i++) { Tuple2<Card, List<Card>> cardTuple2 = stack.pop2(); stack = cardTuple2._2(); hand = hand.add(cardTuple2._1()); } return Tuple.of(hand, stack); }
public Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count) { Set<Card> hand = HashSet.empty(); for (int i = 0; i < count; i++) { Tuple2<Card, ? extends List<Card>> cardTuple2 = stack.pop2(); stack = cardTuple2._2(); hand = hand.add(cardTuple2._1()); } return Tuple.of(hand, stack); }
protected void verifySerialization(TypeReference<?> typeReference, List<Tuple2<?, String>> testValues) throws IOException { ObjectWriter writer = mapper().writerFor(typeReference); for (Tuple2<?, String> testValue : testValues) { Object src = testValue._1(); String expectedJson = testValue._2(); String json = writer.writeValueAsString(src); Assert.assertEquals(expectedJson, json); Object dst = mapper().readValue(json, typeReference); Assert.assertEquals(src, dst); } }