Make an Order by date

Asked

Viewed 27 times

1

I have the following class I want to sort her values by date

public class ItemListAnuncios {

    private String texto;
    private String data;

    public ItemListPropaganda(String texto, String data) {
        this.texto = texto;
        this.data= data;
    }

    public int getTexto() {
        return texto;
    }

    public void setTexto(String texto) {
        this.texto= texto;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data= data;
    }

I have in my main class:

private ArrayList<ItemListAnuncios > itens;

How can I sort? I’d better send it in date or String format?

  • Felipe, take a look at this answer. I believe I can help you: Sort Arraylist

  • @Felipe, as your date is like string is good you put the format of it too.

  • 3

    See the answer to this question: Sorting an Array

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.