Arrays can stream directly.

This commit is contained in:
tastybento 2018-05-27 08:50:14 -07:00
parent 60eac8e54e
commit 3404fac8f2
4 changed files with 4 additions and 4 deletions

View File

@ -141,7 +141,7 @@ public class Flags {
* @return List of all the flags in this class
*/
public static List<Flag> values() {
return Arrays.asList(Flags.class.getFields()).stream().map(field -> {
return Arrays.stream(Flags.class.getFields()).map(field -> {
try {
return (Flag)field.get(null);
} catch (IllegalArgumentException | IllegalAccessException e) {

View File

@ -21,7 +21,7 @@ public class Placeholders {
* @return List of all the flags in this class
*/
public static List<Placeholder> values() {
return Arrays.asList(Placeholders.class.getFields()).stream().map(field -> {
return Arrays.stream(Placeholders.class.getFields()).map(field -> {
try {
return (Placeholder)field.get(null);
} catch (IllegalArgumentException | IllegalAccessException e) {

View File

@ -54,7 +54,7 @@ public class AddonsManager {
if (!f.exists()) {
f.mkdirs();
}
Arrays.asList(f.listFiles()).stream().filter(x -> !x.isDirectory() && x.getName().endsWith(".jar")).forEach(t -> {
Arrays.stream(f.listFiles()).filter(x -> !x.isDirectory() && x.getName().endsWith(".jar")).forEach(t -> {
plugin.log("Loading " + t.getName());
try {
loadAddon(t);

View File

@ -316,7 +316,7 @@ public class IslandsManagerTest {
@Test
public void testBadBlocks() {
// Fences
Arrays.asList(Material.values()).stream().filter(m -> m.toString().contains("FENCE")).forEach(m -> {
Arrays.stream(Material.values()).filter(m -> m.toString().contains("FENCE")).forEach(m -> {
when(ground.getType()).thenReturn(m);
assertFalse("Fence :" + m.toString(), manager.isSafeLocation(location));
});