Returns a tuple that is the concatenation of two tuples.
(Tuple x, Tuple y)
| 103 | |
| 104 | /** Returns a tuple that is the concatenation of two tuples. */ |
| 105 | public static Tuple concat(Tuple x, Tuple y) { |
| 106 | if (x.isEmpty()) { |
| 107 | return y; |
| 108 | } else if (y.isEmpty()) { |
| 109 | return x; |
| 110 | } else { |
| 111 | Object[] xelems = |
| 112 | x instanceof SingletonTuple |
| 113 | ? new Object[] {((SingletonTuple) x).elem} |
| 114 | : ((RegularTuple) x).elems; |
| 115 | Object[] yelems = |
| 116 | y instanceof SingletonTuple |
| 117 | ? new Object[] {((SingletonTuple) y).elem} |
| 118 | : ((RegularTuple) y).elems; |
| 119 | return wrap(ObjectArrays.concat(xelems, yelems, Object.class)); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | @Override |
| 124 | public int compareTo(Tuple that) { |
no test coverage detected