List of usage examples for java.util Collections fill
public static <T> void fill(List<? super T> list, T obj)
From source file:ml.shifu.shifu.core.processor.ExportModelProcessor.java
private String splitUnitStatsToColumn(List<String> unitStats, int size) { List<String> unitHeaders = new ArrayList<String>(size * 3); if (CollectionUtils.isEmpty(unitStats) || unitStats.size() != size) { Collections.fill(unitHeaders, ""); } else {/*ww w . j a v a2 s.c o m*/ unitHeaders.addAll(unitStatsFields(unitStats, 1, "")); unitHeaders.addAll(unitStatsFields(unitStats, 2, "")); unitHeaders.addAll(unitStatsFields(unitStats, 3, "")); } return StringUtils.join(unitHeaders, ","); }
From source file:net.dmulloy2.ultimatearena.arenas.Arena.java
/** * Starts the arena./*from w w w. j a v a2 s . com*/ * <p> * Can not be overriden. */ public final void start() { if (!started) { // Make sure there are enough players if (active.size() < minPlayers) { tellPlayers(getMessage("notEnoughPeople"), minPlayers); stop(); return; } // API - start event ArenaStartEvent event = new ArenaStartEvent(this); plugin.getServer().getPluginManager().callEvent(event); // API - onStart onStart(); // Balance teams if applicable if (forceBalance && lastJoin != null) { if (redTeamSize != blueTeamSize) { Player extra = Util.matchPlayer(lastJoin); if (extra != null) { ArenaPlayer ap = getArenaPlayer(extra); if (ap != null) { ap.leaveArena(LeaveReason.KICK); ap.sendMessage(getMessage("fairnessKick")); } } } } plugin.log("Starting arena {0} with {1} players", name, active.size()); this.started = true; this.inGame = true; this.inLobby = false; this.gameMode = Mode.INGAME; this.startingAmount = active.size(); // Setup the leaderboard for leaderboard signs this.finalLeaderboard = new ArrayList<>(startingAmount); Collections.fill(finalLeaderboard, ""); this.leaderboardIndex = startingAmount - 1; this.gameTimer = maxGameTime; this.startTimer = -1; spawnAll(); } }