@@ -1122,6 +1122,162 @@ violation names use the same format that javap emits.
11221122 <comment >Prefer java.util.OptionalDouble.stream()</comment >
11231123 </violation >
11241124
1125+ <violation >
1126+ <name >com/google/common/collect/Iterables.getOnlyElement:(Ljava/lang/Iterable;)Ljava/lang/Object;</name >
1127+ <version >1.8</version >
1128+ <comment >Prefer Stream.collect(MoreCollectors.onlyElement())</comment >
1129+ </violation >
1130+
1131+ <violation >
1132+ <name >com/google/common/collect/Iterables.getOnlyElement:(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;</name >
1133+ <version >1.8</version >
1134+ <comment >Prefer Stream.collect(MoreCollectors.toOptional()).orElse(defaultValue)</comment >
1135+ </violation >
1136+
1137+ <violation >
1138+ <name >com/google/common/collect/Iterables.frequency:(Ljava/lang/Iterable;Ljava/lang/Object;)I</name >
1139+ <version >1.8</version >
1140+ <comment >Prefer Stream.filter(element::equals).count() or Stream.filter(Predicate.isEqual(element)).count()</comment >
1141+ </violation >
1142+
1143+ <violation >
1144+ <name >com/google/common/collect/Iterables.cycle:(Ljava/lang/Iterable;)Ljava/lang/Iterable;</name >
1145+ <version >1.8</version >
1146+ <comment >Prefer Stream.generate(() -> iterable).flatMap(Streams::stream)</comment >
1147+ </violation >
1148+
1149+ <violation >
1150+ <name >com/google/common/collect/Iterables.cycle:([Ljava/lang/Object;)Ljava/lang/Iterable;</name >
1151+ <version >1.8</version >
1152+ <comment >Prefer Stream equivalent of this method is Stream.generate(() -> e) or Stream.generate(() -> collection).flatMap(Collection::stream)</comment >
1153+ </violation >
1154+
1155+ <violation >
1156+ <name >com/google/common/collect/Iterables.concat:(Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/lang/Iterable;</name >
1157+ <version >1.8</version >
1158+ <comment >Prefer Stream.concat(a, b)</comment >
1159+ </violation >
1160+
1161+ <violation >
1162+ <name >com/google/common/collect/Iterables.concat:(Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/lang/Iterable;</name >
1163+ <version >1.8</version >
1164+ <comment >Prefer Streams.concat(a, b, c)</comment >
1165+ </violation >
1166+
1167+ <violation >
1168+ <name >com/google/common/collect/Iterables.concat:(Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;Ljava/lang/Iterable;)Ljava/lang/Iterable;</name >
1169+ <version >1.8</version >
1170+ <comment >Prefer Streams.concat(a, b, c, d)</comment >
1171+ </violation >
1172+
1173+ <violation >
1174+ <name >com/google/common/collect/Iterables.concat:(Ljava/lang/Iterable;)Ljava/lang/Iterable;</name >
1175+ <version >1.8</version >
1176+ <comment >Prefer Streams.concat(...)</comment >
1177+ </violation >
1178+
1179+ <violation >
1180+ <name >com/google/common/collect/Iterables.concat:([Ljava/lang/Iterable;)Ljava/lang/Iterable;</name >
1181+ <version >1.8</version >
1182+ <comment >Prefer Stream.flatMap(s -> s)</comment >
1183+ </violation >
1184+
1185+ <violation >
1186+ <name >com/google/common/collect/Iterables.filter:(Ljava/lang/Iterable;Lcom/google/common/base/Predicate;)Ljava/lang/Iterable;</name >
1187+ <version >1.8</version >
1188+ <comment >Prefer Stream.filter(java.util.function.Predicate< ? super T> )</comment >
1189+ </violation >
1190+
1191+ <violation >
1192+ <name >com/google/common/collect/Iterables.filter:(Ljava/lang/Iterable;Ljava/lang/Class;)Ljava/lang/Iterable;</name >
1193+ <version >1.8</version >
1194+ <comment >Prefer Stream.filter(type::isInstance).map(type::cast)</comment >
1195+ </violation >
1196+
1197+ <violation >
1198+ <name >com/google/common/collect/Iterables.any:(Ljava/lang/Iterable;Lcom/google/common/base/Predicate;)Z</name >
1199+ <version >1.8</version >
1200+ <comment >Prefer Stream.anyMatch(java.util.function.Predicate< ? super T> )</comment >
1201+ </violation >
1202+
1203+ <violation >
1204+ <name >com/google/common/collect/Iterables.all:(Ljava/lang/Iterable;Lcom/google/common/base/Predicate;)Z</name >
1205+ <version >1.8</version >
1206+ <comment >Prefer Stream.allMatch(java.util.function.Predicate< ? super T> )</comment >
1207+ </violation >
1208+
1209+ <violation >
1210+ <name >com/google/common/collect/Iterables.find:(Ljava/lang/Iterable;Lcom/google/common/base/Predicate;)Ljava/lang/Object;</name >
1211+ <version >1.8</version >
1212+ <comment >Prefer Stream.filter(predicate).findFirst().get()</comment >
1213+ </violation >
1214+
1215+ <violation >
1216+ <name >com/google/common/collect/Iterables.find:(Ljava/lang/Iterable;Lcom/google/common/base/Predicate;Ljava/lang/Object;)Ljava/lang/Object;</name >
1217+ <version >1.8</version >
1218+ <comment >Prefer Stream.filter(predicate).findFirst().orElse(defaultValue)</comment >
1219+ </violation >
1220+
1221+ <violation >
1222+ <name >com/google/common/collect/Iterables.tryFind:(Ljava/lang/Iterable;Lcom/google/common/base/Predicate;)Lcom/google/common/base/Optional;</name >
1223+ <version >1.8</version >
1224+ <comment >Prefer Stream.filter(predicate).findFirst()</comment >
1225+ </violation >
1226+
1227+ <violation >
1228+ <name >com/google/common/collect/Iterables.transform:(Ljava/lang/Iterable;Lcom/google/common/base/Function;)Ljava/lang/Iterable;</name >
1229+ <version >1.8</version >
1230+ <comment >Prefer Stream.map(java.util.function.Function< ? super T, ? extends R> )</comment >
1231+ </violation >
1232+
1233+ <violation >
1234+ <name >com/google/common/collect/Iterables.get:(Ljava/lang/Iterable;I)Ljava/lang/Object;</name >
1235+ <version >1.8</version >
1236+ <comment >Prefer Stream.skip(position).findFirst().get()</comment >
1237+ </violation >
1238+
1239+ <violation >
1240+ <name >com/google/common/collect/Iterables.get:(Ljava/lang/Iterable;ILjava/lang/Object;)Ljava/lang/Object;</name >
1241+ <version >1.8</version >
1242+ <comment >Prefer Stream.skip(position).findFirst().orElse(defaultValue)</comment >
1243+ </violation >
1244+
1245+ <violation >
1246+ <name >com/google/common/collect/Iterables.getFirst:(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;</name >
1247+ <version >1.8</version >
1248+ <comment >Prefer Stream.findFirst().orElse(defaultValue)</comment >
1249+ </violation >
1250+
1251+ <violation >
1252+ <name >com/google/common/collect/Iterables.getLast:(Ljava/lang/Iterable;)Ljava/lang/Object;</name >
1253+ <version >1.8</version >
1254+ <comment >Prefer Streams.findLast(stream).get()</comment >
1255+ </violation >
1256+
1257+ <violation >
1258+ <name >com/google/common/collect/Iterables.getLast:(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;</name >
1259+ <version >1.8</version >
1260+ <comment >Prefer Streams.findLast(stream).orElse(defaultValue)</comment >
1261+ </violation >
1262+
1263+ <violation >
1264+ <name >com/google/common/collect/Iterables.skip:(Ljava/lang/Iterable;I)Ljava/lang/Iterable;</name >
1265+ <version >1.8</version >
1266+ <comment >Prefer Stream.skip(long)</comment >
1267+ </violation >
1268+
1269+ <violation >
1270+ <name >com/google/common/collect/Iterables.limit:(Ljava/lang/Iterable;I)Ljava/lang/Iterable;</name >
1271+ <version >1.8</version >
1272+ <comment >Prefer Stream.limit(long)</comment >
1273+ </violation >
1274+
1275+ <violation >
1276+ <name >com/google/common/collect/Iterables.isEmpty:(Ljava/lang/Iterable;)Z</name >
1277+ <version >1.8</version >
1278+ <comment >Prefer !stream.findAny().isPresent()</comment >
1279+ </violation >
1280+
11251281 <violation >
11261282 <name >com/google/common/collect/Iterators.forEnumeration:(Ljava/util/Enumeration;)Lcom/google/common/collect/UnmodifiableIterator;</name >
11271283 <version >1.9</version >
0 commit comments