BicepBuddyApp/src/main/java/User/UserController.java
public void populateMessages(JTextArea notificationText) {
		//first we need all the notifications.
		Set<Message> messages = getAllNotifications();
		
		//we will only print the first 10, sorted by date.
		List<Message> sorted = messages.stream().collect(Collectors.toList());
		sorted.sort((m1, m2) -> m2.compareTo(m1));
		
		for(int i = 0; i < sorted.size() && i < 10; i++) {
			if(i == 0) {
				notificationText.setText(sorted.get(i).getText() + " --- Send time: " + sorted.get(i).getSendDate());
			}
			else {
				notificationText.setText(notificationText.getText() + "\n\n" + 
						sorted.get(i).getText() + " --- Send time: " + sorted.get(i).getSendDate());
			}
			
		}
		
	}
/**
	 * Populate messages. Goes through the notification messages and addes it to the JtextArea
	 *
	 * @param notificationText the notification text
	 */
Populate messages. Goes through the notification messages and addes it to the JtextArea
@param notificationText the notification text
Populate messages . Goes through the notification messages and addes it to the JtextArea @param notificationText the notification text
public void populateMessages(JTextArea notificationText) {
		Set<Message> messages = getAllNotifications();
		List<Message> sorted = messages.stream().collect(Collectors.toList());
		sorted.sort((m1, m2) -> m2.compareTo(m1));
		for(int i = 0; i < sorted.size() && i < 10; i++) {
			if(i == 0) {
				notificationText.setText(sorted.get(i).getText() + " --- Send time: " + sorted.get(i).getSendDate());
			}
			else {
				notificationText.setText(notificationText.getText() + "\n\n" + 
						sorted.get(i).getText() + " --- Send time: " + sorted.get(i).getSendDate());
			}
		}
	}
public void populateMessages ( JTextArea notificationText ) { Set < Message > messages = getAllNotifications ( ) ; List < Message > sorted = messages . stream ( ) . collect ( Collectors . toList ( ) ) ; sorted . sort ( ( m1 , m2 ) -> m2 . compareTo ( m1 ) ) ; for ( int i = 0 ; i < sorted . size ( ) && i < 10 ; i ++ ) { if ( i == 0 ) { notificationText . setText ( sorted . get ( i ) . getText ( ) + " --- Send time: " + sorted . get ( i ) . getSendDate ( ) ) ; } else { notificationText . setText ( notificationText . getText ( ) + "\n\n" + sorted . get ( i ) . getText ( ) + " --- Send time: " + sorted . get ( i ) . getSendDate ( ) ) ; } } }
Populate messages.
Populate messages .
//first we need all the notifications. //we will only print the first 10, sorted by date.