本文整理匯總了Java中com.google.common.collect.Lists.asList方法的典型用法代碼示例。如果您正苦於以下問題:Java Lists.asList方法的具體用法?Java Lists.asList怎麽用?Java Lists.asList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.Lists
的用法示例。
在下文中一共展示了Lists.asList方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initGlobal
import com.google.common.collect.Lists; //導入方法依賴的package包/類
/**
* Returns a new {@code PermissionCache} initialized with permission assignments
* from the {@code hbase.superuser} configuration key.
*/
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;
}
示例2: SetFetchCommand
import com.google.common.collect.Lists; //導入方法依賴的package包/類
public SetFetchCommand(Set<Long> ids, FetchDataItem fetchItem, FetchDataItem... otherFetchItems) {
this(ids, Lists.asList(fetchItem, otherFetchItems));
}
示例3: FetchCommand
import com.google.common.collect.Lists; //導入方法依賴的package包/類
public FetchCommand(long startId, Optional<Long> stopId, FetchDataItem fetchItem, FetchDataItem... otherFetchItems) {
this(startId, stopId, Lists.asList(fetchItem, otherFetchItems));
}
示例4: StreamingFetchCommand
import com.google.common.collect.Lists; //導入方法依賴的package包/類
public StreamingFetchCommand(long startId, Optional<Long> stopId, Function<ImapMessage, R> messageConsumer, FetchDataItem item, FetchDataItem... otherItems) {
this(startId, stopId, messageConsumer, Lists.asList(item, otherItems));
}
示例5: getProjectsByName
import com.google.common.collect.Lists; //導入方法依賴的package包/類
/**
* Returns with an array or project form the workspace. for the given subset of unique project names. Sugar for
*
* @param projectName
* the name of the project.
* @param otherName
* the name of another project.
* @param rest
* additional names of desired projects.
* @return an array of projects, could contain non-accessible project.
*/
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;
}
示例6: CompositeValidationIssueProcessor
import com.google.common.collect.Lists; //導入方法依賴的package包/類
/**
* Creates a new composite issue processor with the given sub processor arguments.
*
* @param first
* the first sub processor.
* @param others
* the other processor;
*/
public CompositeValidationIssueProcessor(final IValidationIssueProcessor first,
final IValidationIssueProcessor... others) {
processors = Lists.asList(first, others);
}
示例7: ExternalLibraryPreferenceModel
import com.google.common.collect.Lists; //導入方法依賴的package包/類
/**
* Creates a new model instance with the given location arguments.
*
* @param firstLocation
* the external library folder location.
* @param restLocations
* other external library folder locations.
*/
public ExternalLibraryPreferenceModel(final URI firstLocation, final URI... restLocations) {
this(Lists.asList(firstLocation, restLocations));
}
示例8: asList
import com.google.common.collect.Lists; //導入方法依賴的package包/類
/**
* 一個獨立元素+一個數組組成新的list,隻是一個View,不複製數組內容,而且獨立元素在最前.
*
*
* 注意轉換後的List不能寫入, 否則拋出UnsupportedOperationException
*
* @see com.google.common.collect.Lists#asList(Object, Object[])
*/
public static <E> List<E> asList(E first, E[] rest) {
return Lists.asList(first, rest);
}