0
ArrayList display = new ArrayList();
for (Player p : game.getAllPlayers())
  display.add(new StringBuilder().append(game.isPlayerActive(p) ? ChatColor.BLACK : ChatColor.GRAY).append(NameUtil.stylize(p.getName(), true, !game.isPlayerActive(p))).toString()); int no;
  int line;
  try {
    no = 2;
    line = 0;
    for (String s : display) {
      ((Sign)this.signs.get(no)).setLine(line, s);
      line++;
      if (line >= 4) {
        line = 0;
        no++;
      }
    }
  } catch (Exception e) {  }

  for (Sign s : this.signs)
    s.update();

Can someone Help me??. when i write "for (String s : display) {" it gives me a DISPLAY error

NickJ
  • 9,380
  • 9
  • 51
  • 74

1 Answers1

1

change

ArrayList display = new ArrayList();

to

ArrayList<String> display = new ArrayList<String>();

but as a best practice, left element must be an interface, so it is better to set:

List<String> display = new ArrayList<String>();

or, even better

Collection<String> display = new ArrayList<String>();
RamonBoza
  • 8,898
  • 6
  • 36
  • 48
  • I disagree with "must be an interface" and your assumptions about OP's usage. If you only need it as a `Collection`, then of course you can declare as such, but what if he/she needs random access and ordering? Just declare it as whatever is appropriate. – Zong Nov 15 '13 at 16:23