public static void main(String[] args) {
List<String> strings = Lists.asList("s1", "s2", "s3");
}
class ListUtils
{
public static void main(String[] args)
{
int first = 10;
int second = 20;
Integer[] rest = { 30, 40, 50 };
// List contains 'first' element followed by elements of
// the 'rest' array
List<Integer> firstList = Lists.asList(first, rest);
System.out.println(firstList);
// List contains 'first' and 'second' element followed by
// elements of the 'rest' array
List<Integer> secondList = Lists.asList(first, second, rest);
System.out.println(secondList);
// List contains elements of the 'rest' array
List<Integer> list = Lists.asList(null, rest)
.subList(1, rest.length + 1);
System.out.println(list);
}
}
public static void main(String[] args) {
Lists.newArrayList("Mike", "John", "Lesly");
Lists.asList("A","B", new String [] {"C", "D"});
}
public static void main(String[] args) {
List<String> list1 = Lists.asList("1", new String[]{});
List<String> list2 = Lists.asList("1", new String[]{"2"});
List<String> list3 = Lists.asList("1", "2", new String[]{"3"});
}
public void create_new_unmodified_list () {
String[] vals = {"test1", "test2"};
List<String> myList = Lists.asList("test0", vals);
assertNotNull(myList);
}
private PermissionCache<Permission> initGlobal(Configuration conf) throws IOException {
UserProvider userProvider = UserProvider.instantiate(conf);
User user = userProvider.getCurrent();
if (user == null) {
throw new IOException("Unable to obtain the current user, " +
"authorization checks for internal operations will not work correctly!");
}
PermissionCache<Permission> newCache = new PermissionCache<Permission>();
String currentUser = user.getShortName();
// the system user is always included
List<String> superusers = Lists.asList(currentUser, conf.getStrings(
Superusers.SUPERUSER_CONF_KEY, new String[0]));
if (superusers != null) {
for (String name : superusers) {
if (AuthUtil.isGroupPrincipal(name)) {
newCache.putGroup(AuthUtil.getGroupName(name),
new Permission(Permission.Action.values()));
} else {
newCache.putUser(name, new Permission(Permission.Action.values()));
}
}
}
return newCache;
}
public SetFetchCommand(Set<Long> ids, FetchDataItem fetchItem, FetchDataItem... otherFetchItems) {
this(ids, Lists.asList(fetchItem, otherFetchItems));
}
protected IProject[] getProjectsByName(final String projectName, final String otherName, final String... rest) {
final List<String> projectNames = Lists.asList(projectName, otherName, rest);
final IProject[] projects = new IProject[projectNames.size()];
for (int i = 0; i < projects.length; i++) {
projects[i] = getProjectByName(projectNames.get(i));
}
return projects;
}
public CompositeValidationIssueProcessor(final IValidationIssueProcessor first,
final IValidationIssueProcessor... others) {
processors = Lists.asList(first, others);
}
public static <E> List<E> asList(E first, E[] rest) {
return Lists.asList(first, rest);
}
protected Process runAdb(String... arguments){
List<String> commandLine=Lists.asList(adbPath,arguments);
ProcessBuilder processBuilder=newProcessBuilder(commandLine);
Map<String,String> environment=processBuilder.environment();
if (adbServerPort != null) {
environment.put("ANDROID_ADB_SERVER_PORT",adbServerPort.toString());
}
if (emulatorConsolePort != null) {
environment.put("ANDROID_EMULATOR_CONSOLE_PORT",emulatorConsolePort.toString());
}
if (emulatorAdbPort != null) {
environment.put("ANDROID_EMULATOR_ADB_PORT",emulatorAdbPort.toString());
}
try {
return callProcessBuilderStart(processBuilder);
}
catch ( IOException exception) {
throw new AdbException("An IOException occurred when starting ADB.",exception);
}
}