mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-176977 EnumSet.of().stream() can be simplified to Stream.of()
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// "Replace EnumSet.of().stream() with Stream.of()" "true"
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
|
||||
public class Tests {
|
||||
interface HasCode {
|
||||
default String getCode() {return this.toString();}
|
||||
}
|
||||
|
||||
enum Status implements HasCode {
|
||||
Approved, Pending, Stored
|
||||
}
|
||||
|
||||
void test() {
|
||||
List<String> list = Stream.of(Status.Approved, (Status.Pending), Status.Stored)
|
||||
.map(HasCode::getCode).collect(toList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// "Replace EnumSet.of().stream() with Stream.of()" "true"
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
|
||||
public class Tests {
|
||||
interface HasCode {
|
||||
default String getCode() {return this.toString();}
|
||||
}
|
||||
|
||||
enum Status implements HasCode {
|
||||
Approved, Pending, Stored
|
||||
}
|
||||
|
||||
void test() {
|
||||
List<String> list = EnumSet.of(Status.Approved, (Status.Pending), Status.Stored).st<caret>ream()
|
||||
.map(HasCode::getCode).collect(toList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// "Fix all 'Simplify stream API call chains' problems in file" "false"
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
|
||||
public class Tests {
|
||||
interface HasCode {
|
||||
default String getCode() {return this.toString();}
|
||||
}
|
||||
|
||||
enum Status implements HasCode {
|
||||
Approved, Pending, Stored
|
||||
}
|
||||
|
||||
void test() {
|
||||
List<String> list = EnumSet.of().st<caret>ream()
|
||||
.map(HasCode::getCode).collect(toList());
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// "Fix all 'Simplify stream API call chains' problems in file" "false"
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
|
||||
public class Tests {
|
||||
interface HasCode {
|
||||
default String getCode() {return this.toString();}
|
||||
}
|
||||
|
||||
enum Status implements HasCode {
|
||||
Approved, Pending, Stored;
|
||||
|
||||
static final Status Alias = Approved;
|
||||
}
|
||||
|
||||
void test() {
|
||||
List<String> list = EnumSet.of(Status.Approved, Status.Pending, Status.Stored, Status.Alias).stre<caret>am()
|
||||
.map(HasCode::getCode).collect(toList());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// "Fix all 'Simplify stream API call chains' problems in file" "false"
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
|
||||
public class Tests {
|
||||
interface HasCode {
|
||||
default String getCode() {return this.toString();}
|
||||
}
|
||||
|
||||
enum Status implements HasCode {
|
||||
Approved, Pending, Stored
|
||||
}
|
||||
|
||||
void test() {
|
||||
List<String> list = EnumSet.of(Status.Approved, Status.Pending, Status.Stored, Status.Approved).st<caret>ream()
|
||||
.map(HasCode::getCode).collect(toList());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user