本文整理匯總了Java中com.google.common.collect.Lists.reverse方法的典型用法代碼示例。如果您正苦於以下問題:Java Lists.reverse方法的具體用法?Java Lists.reverse怎麽用?Java Lists.reverse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.common.collect.Lists
的用法示例。
在下文中一共展示了Lists.reverse方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addSecurityRules
import com.google.common.collect.Lists; //導入方法依賴的package包/類
public void addSecurityRules ( final Rules rules, final IProgressMonitor monitor )
{
if ( rules == null )
{
return;
}
int priority = 1000;
monitor.beginTask ( "Encoding security rules", rules.getRules ().size () );
for ( final Rule rule : Lists.reverse ( rules.getRules () ) )
{
final RuleEncoder encoder = RuleEncoder.findEncoder ( rule );
if ( encoder != null )
{
encoder.encodeRule ( this.ctx, priority += 100 );
}
monitor.worked ( 1 );
}
monitor.done ();
}
示例2: prepare
import com.google.common.collect.Lists; //導入方法依賴的package包/類
public void prepare() {
this.finalDownstream.prepare();
for (Projector projector : Lists.reverse(nodeProjectors)) {
projector.prepare();
}
if (shardProjectionsIndex >= 0) {
for (Projector p : shardProjectors) {
p.prepare();
}
}
}
示例3: getYValue
import com.google.common.collect.Lists; //導入方法依賴的package包/類
/**
* Algorithm 7.9: GetYValue
* <p>Generates the coefficients a_0, ..., a_d of a random polynomial</p>
*
* @param x value in Z_p_prime
* @param bold_a the coefficients of the polynomial
* @return the computed value y
*/
public BigInteger getYValue(BigInteger x, List<BigInteger> bold_a) {
Preconditions.checkArgument(bold_a.size() >= 1,
String.format("The size of bold_a should always be larger or equal to 1 (it is [%d]", bold_a.size()));
if (x.equals(BigInteger.ZERO)) {
return bold_a.get(0);
} else {
BigInteger y = BigInteger.ZERO;
for (BigInteger a_i : Lists.reverse(bold_a)) {
y = a_i.add(x.multiply(y).mod(primeField.getP_prime())).mod(primeField.getP_prime());
}
return y;
}
}
開發者ID:republique-et-canton-de-geneve,項目名稱:chvote-protocol-poc,代碼行數:22,代碼來源:PolynomialAlgorithms.java
示例4: render
import com.google.common.collect.Lists; //導入方法依賴的package包/類
void render(PerformanceTestHistory testHistory, Transformer<String, MeasuredOperationList> valueRenderer, PrintWriter out) {
List<? extends PerformanceTestExecution> sortedResults = Lists.reverse(testHistory.getExecutions());
out.println(" [");
List<String> labels = testHistory.getScenarioLabels();
for (int i = 0; i < labels.size(); i++) {
if (i > 0) {
out.println(",");
}
out.println(" {");
out.println(" \"label\": \"" + labels.get(i) + "\",");
out.print("\"data\": [");
boolean empty = true;
for (int j = 0; j < sortedResults.size(); j++) {
PerformanceTestExecution results = sortedResults.get(j);
MeasuredOperationList measuredOperations = results.getScenarios().get(i);
if (!measuredOperations.isEmpty()) {
if (!empty) {
out.print(", ");
}
out.print("[" + j + ", " + valueRenderer.transform(measuredOperations) + "]");
empty = false;
}
}
out.println("]");
out.print(" }");
}
out.println();
out.println("]");
}
示例5: load
import com.google.common.collect.Lists; //導入方法依賴的package包/類
/**
* Load the cached profiles from disk
*/
public void load()
{
BufferedReader bufferedreader = null;
try
{
bufferedreader = Files.newReader(this.usercacheFile, Charsets.UTF_8);
List<PlayerProfileCache.ProfileEntry> list = (List)this.gson.fromJson((Reader)bufferedreader, TYPE);
this.usernameToProfileEntryMap.clear();
this.uuidToProfileEntryMap.clear();
this.gameProfiles.clear();
for (PlayerProfileCache.ProfileEntry playerprofilecache$profileentry : Lists.reverse(list))
{
if (playerprofilecache$profileentry != null)
{
this.addEntry(playerprofilecache$profileentry.getGameProfile(), playerprofilecache$profileentry.getExpirationDate());
}
}
}
catch (FileNotFoundException var9)
{
;
}
catch (JsonParseException var10)
{
;
}
finally
{
IOUtils.closeQuietly((Reader)bufferedreader);
}
}
示例6: pairTracks
import com.google.common.collect.Lists; //導入方法依賴的package包/類
public static void pairTracks(Track t1, Track t2) {
if (t1.getLength() != t2.getLength()) {
throw new IllegalStateException("Tracks of different length detected." +
" T1: " + t1.getLength() + ", T2: " + t2.getLength());
}
List<Section> sections1 = t1.getSections();
List<Section> sections2 = Lists.reverse(t2.getSections());
for (int j = 0; j < sections1.size(); j++) {
ActiveBalise ab1 = getActiveBalise(sections1.get(j));
ActiveBalise ab2 = getActiveBalise(sections2.get(j));
if (ab1 == null && ab2 == null) {
continue;
}
// sanity checks
if (ab1 == null) {
throw new IllegalStateException("Null balise on left side, Non-null on right side");
} else if (ab2 == null) {
throw new IllegalStateException("Null balise on right side, Non-null on left side");
}
// pair the two balises
ab1.setDualTrackPair(ab2);
ab2.setDualTrackPair(ab1);
}
}
示例7: getErrorMessage
import com.google.common.collect.Lists; //導入方法依賴的package包/類
private String getErrorMessage(String initMsg) {
List<String> locators = Lists.reverse(getLocators());
if (locators.size() > 0) {
initMsg += ": ";
StringJoiner joiner = new StringJoiner(", ");
for (String loc : locators) {
joiner.add(loc);
}
initMsg += joiner.toString();
}
initMsg += " " + configError;
return initMsg;
}
示例8: initGui
import com.google.common.collect.Lists; //導入方法依賴的package包/類
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui()
{
this.buttonList.add(new GuiOptionButton(2, this.width / 2 - 154, this.height - 48, I18n.format("resourcePack.openFolder", new Object[0])));
this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 4, this.height - 48, I18n.format("gui.done", new Object[0])));
if (!this.changed)
{
this.availableResourcePacks = Lists.<ResourcePackListEntry>newArrayList();
this.selectedResourcePacks = Lists.<ResourcePackListEntry>newArrayList();
ResourcePackRepository resourcepackrepository = this.mc.getResourcePackRepository();
resourcepackrepository.updateRepositoryEntriesAll();
List<ResourcePackRepository.Entry> list = Lists.newArrayList(resourcepackrepository.getRepositoryEntriesAll());
list.removeAll(resourcepackrepository.getRepositoryEntries());
for (ResourcePackRepository.Entry resourcepackrepository$entry : list)
{
this.availableResourcePacks.add(new ResourcePackListEntryFound(this, resourcepackrepository$entry));
}
for (ResourcePackRepository.Entry resourcepackrepository$entry1 : Lists.reverse(resourcepackrepository.getRepositoryEntries()))
{
this.selectedResourcePacks.add(new ResourcePackListEntryFound(this, resourcepackrepository$entry1));
}
this.selectedResourcePacks.add(new ResourcePackListEntryDefault(this));
}
this.availableResourcePacksList = new GuiResourcePackAvailable(this.mc, 200, this.height, this.availableResourcePacks);
this.availableResourcePacksList.setSlotXBoundsFromLeft(this.width / 2 - 4 - 200);
this.availableResourcePacksList.registerScrollButtons(7, 8);
this.selectedResourcePacksList = new GuiResourcePackSelected(this.mc, 200, this.height, this.selectedResourcePacks);
this.selectedResourcePacksList.setSlotXBoundsFromLeft(this.width / 2 + 4);
this.selectedResourcePacksList.registerScrollButtons(7, 8);
}
示例9: getSortedOperators
import com.google.common.collect.Lists; //導入方法依賴的package包/類
public List<PhysicalOperator> getSortedOperators(boolean reverse){
List<PhysicalOperator> list = GraphAlgos.TopoSorter.sort(graph);
if(reverse){
return Lists.reverse(list);
}else{
return list;
}
}
示例10: tearDown
import com.google.common.collect.Lists; //導入方法依賴的package包/類
@After
public void tearDown() {
for (MemberNode m : Lists.reverse(memberNodes)) {
m.cleanup();
}
memberNodes.clear();
}
示例11: interceptCall
import com.google.common.collect.Lists; //導入方法依賴的package包/類
@Override
public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> call, Metadata headers, ServerCallHandler<ReqT, RespT> next) {
// reverse the interceptors list so that the last interceptor to call is the most nested interceptor
for (ServerInterceptor interceptor : Lists.reverse(interceptors)) {
next = new InterceptorServerCallHandler<>(next, interceptor);
}
return next.startCall(call, headers);
}
示例12: initGuestUserState
import com.google.common.collect.Lists; //導入方法依賴的package包/類
@Override
public void initGuestUserState(ModifiableUserState state)
{
// Let the more authoritative user directories supply details first by
// doing this in reverse.
for( UserDirectory ud : Lists.reverse(uds) )
{
ud.initGuestUserState(state);
}
}
示例13: load
import com.google.common.collect.Lists; //導入方法依賴的package包/類
/**
* Load the cached profiles from disk
*/
public void load()
{
BufferedReader bufferedreader = null;
try
{
bufferedreader = Files.newReader(this.usercacheFile, Charsets.UTF_8);
List<PlayerProfileCache.ProfileEntry> list = (List)this.gson.fromJson((Reader)bufferedreader, TYPE);
this.usernameToProfileEntryMap.clear();
this.uuidToProfileEntryMap.clear();
this.gameProfiles.clear();
if (list != null)
{
for (PlayerProfileCache.ProfileEntry playerprofilecache$profileentry : Lists.reverse(list))
{
if (playerprofilecache$profileentry != null)
{
this.addEntry(playerprofilecache$profileentry.getGameProfile(), playerprofilecache$profileentry.getExpirationDate());
}
}
}
}
catch (FileNotFoundException var9)
{
;
}
catch (JsonParseException var10)
{
;
}
finally
{
IOUtils.closeQuietly((Reader)bufferedreader);
}
}
示例14: onBeforeClass
import com.google.common.collect.Lists; //導入方法依賴的package包/類
/**
* [IClassListener]
* Invoked after the test class is instantiated and before
* {@link org.testng.annotations.BeforeClass @BeforeClass}
* configuration methods are called.
*
* @param testClass TestNG representation for the current test class
*/
@Override
public void onBeforeClass(ITestClass testClass) {
synchronized (classListeners) {
for (IClassListener classListener : Lists.reverse(classListeners)) {
classListener.onBeforeClass(testClass);
}
}
}
示例15: getTokens
import com.google.common.collect.Lists; //導入方法依賴的package包/類
/**
* Lex the input and return a list of {@link RawTok}s.
*/
public static ImmutableList<RawTok> getTokens(
String source, Context context, Set<TokenKind> stopTokens) {
if (source == null) {
return ImmutableList.of();
}
ScannerFactory fac = ScannerFactory.instance(context);
char[] buffer = (source + EOF_COMMENT).toCharArray();
Scanner scanner =
new AccessibleScanner(fac, new CommentSavingTokenizer(fac, buffer, buffer.length));
ImmutableList.Builder<RawTok> tokens = ImmutableList.builder();
int last = 0;
do {
scanner.nextToken();
Token t = scanner.token();
if (t.comments != null) {
for (Comment c : Lists.reverse(t.comments)) {
if (last < c.getSourcePos(0)) {
tokens.add(new RawTok(null, null, last, c.getSourcePos(0)));
}
tokens.add(
new RawTok(null, null, c.getSourcePos(0), c.getSourcePos(0) + c.getText().length()));
last = c.getSourcePos(0) + c.getText().length();
}
}
if (stopTokens.contains(t.kind)) {
break;
}
if (last < t.pos) {
tokens.add(new RawTok(null, null, last, t.pos));
}
tokens.add(
new RawTok(
t.kind == TokenKind.STRINGLITERAL ? "\"" + t.stringVal() + "\"" : null,
t.kind,
t.pos,
t.endPos));
last = t.endPos;
} while (scanner.token().kind != TokenKind.EOF);
if (last < source.length()) {
tokens.add(new RawTok(null, null, last, source.length()));
}
return tokens.build();
}