sort.pp 534 B

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