sort.pp 505 B

123456789101112131415161718192021222324252627282930
  1. program sort;
  2. {$mode delphi}
  3. uses
  4. jdk15;
  5. function test : string;
  6. var
  7. sa : array of JLObject;
  8. L : JUList;
  9. i : integer;
  10. begin
  11. SetLength(sa, 3);
  12. sa[0] := JLString(string('2'));
  13. sa[1] := JLString(string('3'));
  14. sa[2] := JLString(string('1'));
  15. L := JUArrays.asList(sa);
  16. JUCollections.sort(L);
  17. Result := '';
  18. for i := 0 to L.size() - 1 do
  19. Result := Result + string(L.get(i)) + string(' ');
  20. end;
  21. begin
  22. jlsystem.fout.println(test);
  23. if test<>'1 2 3 ' then
  24. raise JLException.create;
  25. end.