ihr seid meine letzte hoffnung hier. ihc hab bis heut nacht um 3 an nem sortieralgorythmus gesessen und kriegs net gebacken.
kurz zur erklärung. das ist eine arraylist vom typ integer. darin sind artikelnummer gespeichert. mit den artikelnnummern bekommt man die artikel. die sollen alphabetisch sortiert werden.
ArrayList<Integer> allAuctionArticles = applicationLogicAccess.ApplicationLogicAccess.getA
llAuctionArticles();
ArrayList<Integer> allSaleArticles = applicationLogicAccess.ApplicationLogicAccess.getA
llDirectSales();
ArrayList<Integer> giveToHTML = new ArrayList();
applicationLogicAccess.ApplicationLogicAccess
.getAllDirectSales();
int size1 = allAuctionArticles.size();
//AuktionsArtikel sortieren
for (int j = 0; j < size1; j ++)
{
for (int i = 0; i < size1 -2; i ++)
{
System.out.println(allAuctionArticles);
try {
String a = applicationLogicAccess.ApplicationLogicAccess.getA
rticleToString(allAuctionArticles.get(i));
String b = applicationLogicAccess.ApplicationLogicAccess.getA
rticleToString(allAuctionArticles.get(i+1));
String a1 = a.substring( 7, 8 );
String b1 = b.substring( 7, 8 );
int lexicalSize1 = b1.compareToIgnoreCase("A");
int lexicalSize2 = a1.compareToIgnoreCase("A");
System.out.println(lexicalSize1);
System.out.println(lexicalSize2);
if (lexicalSize1 > lexicalSize2 || lexicalSize1 == lexicalSize2)
{
int aa = allAuctionArticles.get(i);
giveToHTML.add(aa);
int bb = allAuctionArticles.get(i+1);
giveToHTML.add(bb);
i++;
}
if (lexicalSize1 < lexicalSize2)
{
giveToHTML.add(allAuctionArticles.get(i));
giveToHTML.add(allAuctionArticles.get(i+1));
i++;
}
}
catch (ArticleNotFoundException e)
{
quarry();
}
}
allAuctionArticles.clear();
System.out.println("vor dem Clear"+allAuctionArticles);
System.out.println(giveToHTML);
allAuctionArticles = (ArrayList<Integer>) giveToHTML.clone();
giveToHTML.clear();
System.out.println(allAuctionArticles);
}
aber der sortiert einfach überhaupt nicht
danke im vorraus,
lod14

Hilfe
Neues Thema
Antworten


Nach oben










