From 00a4355025ebfe9ef9badd4acb5dfd706e1fa919 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Mon, 29 Feb 2016 02:38:51 +0000 Subject: [PATCH] Added Comparable implementation to Artist. --- src/main/java/musicplayer/model/Artist.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/musicplayer/model/Artist.java b/src/main/java/musicplayer/model/Artist.java index 403d5be..65950eb 100644 --- a/src/main/java/musicplayer/model/Artist.java +++ b/src/main/java/musicplayer/model/Artist.java @@ -4,7 +4,7 @@ import javax.persistence.*; import java.util.Set; @Entity -public class Artist { +public class Artist implements Comparable{ @Id @GeneratedValue(strategy = GenerationType.AUTO) @@ -56,4 +56,9 @@ public class Artist { public long getId() { return id; } + + @Override + public int compareTo(Artist o) { + return toString().compareToIgnoreCase(o.toString()); + } }