src.samples.java.ex.LUI_Sample Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fb-contrib Show documentation
Show all versions of fb-contrib Show documentation
An auxiliary findbugs.sourceforge.net plugin for java bug detectors that fall outside the narrow scope of detectors to be packaged with the product itself.
package ex;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class LUI_Sample {
public List testUseSingleton() {
return Arrays.asList("foo");
}
public Set testAddVsAddAll(String one) {
Set s = new HashSet<>();
if ("foo".equals(one)) {
s.addAll(Collections.singletonList(one));
} else {
s.addAll(Arrays.asList(one));
}
return s;
}
public String streamForGet0(List s) {
return s.stream().findFirst().get();
}
public List fpWithArray() {
return Arrays.asList("foo", "bar");
}
}