Github user clohfink commented on a diff in the pull request:
https://github.com/apache/cassandra/pull/161#discussion_r143230080
--- Diff: src/java/org/apache/cassandra/cql3/CQL3Type.java ---
@@ -826,13 +827,18 @@ public CQL3Type prepare(String keyspace, Types udts)
throws InvalidRequestExcept
freeze();
List<AbstractType<?>> ts = new ArrayList<>(types.size());
- for (CQL3Type.Raw t : types)
- {
- if (t.isCounter())
- throw new InvalidRequestException("Counters are
not allowed inside tuples");
-
- ts.add(t.prepare(keyspace, udts).getType());
- }
+ types.stream()
+ .map(
+ t -> {
+ if (t.isCounter())
+ throw new InvalidRequestException(
+ "Counters are not allowed
inside tuples");
+ return t;
+ })
+ .forEach(
+ t -> {
+ ts.add(t.prepare(keyspace,
udts).getType());
+ });
--- End diff --
This looks worse, and if your going to convert to a new list you can just
do the mapping like
```
types.stream().map(t ->
{
if (t.isCounter())
throw new InvalidRequestException("Counters are not allowed inside
tuples");
return t.prepare(keyspace, udts).getType()
}
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]