コード例 #1
0
 /**
  * Combines two combinations into one by merging the the two combinations' {@link
  * Combination.Key}s and adding the payloads together.
  *
  * @param left Left combination.
  * @param right Right combination.
  */
 public Combination(final Combination<P> left, final Combination<P> right) {
   ValidateAs.notNull(left, "left");
   ValidateAs.notNull(right, "right");
   this.key = new Key(left.getKey(), right.getKey());
   this.payload = left.payload.add(right.payload);
   if (this.payload == null) {
     throw new IllegalStateException(
         left.payload.getClass().getName() + ".add(rhs) cannot return null.");
   }
 }
コード例 #2
0
 public Combination(final int index, final P payload) {
   this.key = new Key(index);
   this.payload = ValidateAs.notNull(payload, "payload");
 }