Skip to content

David Bylund - #147

Open
ReRaulReb wants to merge 1 commit into
boolean-uk:mainfrom
ReRaulReb:main
Open

David Bylund#147
ReRaulReb wants to merge 1 commit into
boolean-uk:mainfrom
ReRaulReb:main

Conversation

@ReRaulReb

Copy link
Copy Markdown

No description provided.

Copilot AI lite review requested due to automatic review settings August 19, 2026 15:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds new Todo list/domain implementations for both the core and extension packages, along with JUnit tests to validate list operations (add, status changes, filtering, search, delete, ordering, and extension-only ID/date features).

Changes:

  • Introduces Task + TodoList in com.booleanuk.core and corresponding tests.
  • Introduces ExTask + ExTodoList in com.booleanuk.extension and corresponding tests, including ID-based operations and date/time formatting.
  • Expands existing TodoListTest with additional behavioral tests.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/main/java/com/booleanuk/core/TodoList.java Implements core todo list operations (add, status, filtering, search, delete, ordering).
src/main/java/com/booleanuk/core/pojo/Task.java Adds the core task POJO used by TodoList.
src/main/java/com/booleanuk/extension/ExTodoList.java Implements extension todo list operations, including ID and date/time features.
src/main/java/com/booleanuk/extension/ExTask.java Adds the extension task model with ID and creation timestamp.
src/test/java/com/booleanuk/core/TodoListTest.java Adds tests for core todo list behaviors.
src/test/java/com/booleanuk/core/pojo/TaskTest.java Adds tests for the core task model.
src/test/java/com/booleanuk/extension/ExTodoListTest.java Adds tests for extension todo list behaviors (including ID/date/time).
src/test/java/com/booleanuk/extension/ExTaskTest.java Adds tests for the extension task model.
Suppressed comments (6)

src/main/java/com/booleanuk/extension/ExTodoList.java:32

  • String comparison uses == (reference equality) instead of value equality, so status changes can silently fail depending on how the String was constructed.
	public void changeStatus(String task, boolean status){
		for(ExTask t : this.tdList){
			if(task == t.getTask())
				t.setComplet(status);
		}

src/main/java/com/booleanuk/extension/ExTodoList.java:70

  • String comparison uses == (reference equality) and the list is mutated during a foreach loop. Switching to an index-based loop avoids iteration/modification pitfalls and ensures value-based matching.
	public void delete(String task){
		int i = 0;
		for(ExTask t: this.tdList){
			if(t.getTask() == task){
				this.tdList.remove(i);
				break;
			}
			i++;
		}	
	}

src/main/java/com/booleanuk/extension/ExTodoList.java:79

  • Building the result with += in a loop is O(n²) and tmpList aliases tdList, so calling this method also reorders the underlying list. Using a copied list and StringBuilder avoids both issues.
	public String orderAscend(){
		String tmpStr = "";
		List<ExTask> tmpList = this.tdList;
		tmpList.sort(Comparator.comparing(ExTask::getTask, String.CASE_INSENSITIVE_ORDER));
		for (ExTask t : tmpList){
			tmpStr += t.getTask() + "\n";
		}
		return tmpStr.trim();

src/main/java/com/booleanuk/extension/ExTodoList.java:89

  • Building the result with += in a loop is O(n²) and tmpList aliases tdList, so calling this method also reorders the underlying list. Using a copied list and StringBuilder avoids both issues.
	public String orderDescend(){
		String tmpStr = "";
		List<ExTask> tmpList = this.tdList;
		tmpList.sort(Comparator.comparing(ExTask::getTask, String.CASE_INSENSITIVE_ORDER).reversed());
		for (ExTask t : tmpList){
			tmpStr += t.getTask() + "\n";
		}
		return tmpStr.trim();

src/main/java/com/booleanuk/core/TodoList.java:68

  • String comparison uses == (reference equality) and the list is mutated during a foreach loop. Switching to an index-based loop avoids iteration/modification pitfalls and ensures value-based matching.
	public void delete(String task){
		int i = 0;
		for(Task t: this.tdList){
			if(t.getTask() == task){
				this.tdList.remove(i);
				break;
			}
			i++;
		}	
	}

src/main/java/com/booleanuk/core/TodoList.java:87

  • Building the result with += in a loop is O(n²) and tmpList aliases tdList, so calling this method also reorders the underlying list. Using a copied list and StringBuilder avoids both issues.
	public String orderDescend(){
		String tmpStr = "";
		List<Task> tmpList = this.tdList;
		tmpList.sort(Comparator.comparing(Task::getTask, String.CASE_INSENSITIVE_ORDER).reversed());
		for (Task t : tmpList){
			tmpStr += t.getTask() + "\n";
		}
		return tmpStr.trim();

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +19 to +22
public void add(ExTask task){
task.id = incrementID;
this.tdList.add(task);
}
Comment on lines +115 to +123
public String dateTime(){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
String tmp = "";
for(ExTask t : tdList){
String tmpStr = t.getDate().format(formatter);
tmp += t.getTask() + " " + tmpStr + "\n";
}
return tmp.trim();
}
Comment on lines +26 to +30
public void changeStatus(String task, boolean status){
for(Task t : this.tdList){
if(task == t.getTask())
t.setComplet(status);
}
Comment on lines +70 to +78
public String orderAscend(){
String tmpStr = "";
List<Task> tmpList = this.tdList;
tmpList.sort(Comparator.comparing(Task::getTask, String.CASE_INSENSITIVE_ORDER));
for (Task t : tmpList){
tmpStr += t.getTask() + "\n";
}
return tmpStr.trim();
}
Comment on lines +235 to +240
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");

String expected = "Fix nvim config " +
LocalDateTime.now().format(formatter) + "\nClean house " + LocalDateTime.now().format(formatter);

Assertions.assertEquals(expected, tdList.dateTime());
Comment on lines +6 to +8
private String task;
private boolean complet;
protected int id;
Comment on lines +4 to +6
private String task;
private boolean complet;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants