src/main/java/com/danielezihe/controllers/ToDoController.java
/**
     * Finds a todo from the todos BidiMap. Searches only the Todo CreatedAt property
     * @param query Query text to be searched
     * @param queryType Date format/type the @param(query) is in.
     * @return an {@link OrderedMap} containing the query result
     */
Finds a todo from the todos BidiMap. Searches only the Todo CreatedAt property
@param query Query text to be searched
@param queryType Date format/type the @param(query) is in.
@return an  OrderedMap containing the query result
Finds a todo from the todos BidiMap . Searches only the Todo CreatedAt property @param query Query text to be searched @param queryType Date format / type the @param ( query ) is in . @return an OrderedMap containing the query result
public OrderedMap<Integer, ToDoEntity> findTodo(String query, CreatedAtQueryTypes queryType) {
        OrderedMap<Integer, ToDoEntity> queryTodos = new LinkedMap<>();
        Stream<ToDoEntity> todosStream;
        todosList = new ArrayList<>(todos.values());
        switch (queryType) {
            case FULL_DATE -> {
                todosStream = todosList.stream().filter(o -> IOCase.INSENSITIVE.checkEquals(query, getDateString(o.getCreatedAt(), CreatedAtQueryTypes.FULL_DATE)));
            }
            case SHORT_DATE -> {
                todosStream = todosList.stream().filter(o -> IOCase.INSENSITIVE.checkEquals(query, getDateString(o.getCreatedAt(), CreatedAtQueryTypes.SHORT_DATE)));
            }
            case TIME -> {
                todosStream = todosList.stream().filter(o -> IOCase.INSENSITIVE.checkEquals(query, getDateString(o.getCreatedAt(), CreatedAtQueryTypes.TIME)));
            }
            case DATE_TIME -> {
                todosStream = todosList.stream().filter(o -> IOCase.INSENSITIVE.checkEquals(query, getCreatedAtDateTimeShort(o.getCreatedAt())));
            }
            default -> {
                return queryTodos;
            }
        }
        todosStream.forEach(
                o -> {
                    queryTodos.put(o.getId(), o);
                }
        );
        return queryTodos;
    }
public OrderedMap < Integer , ToDoEntity > findTodo ( String query , CreatedAtQueryTypes queryType ) { OrderedMap < Integer , ToDoEntity > queryTodos = new LinkedMap < > ( ) ; Stream < ToDoEntity > todosStream ; todosList = new ArrayList < > ( todos . values ( ) ) ; switch ( queryType ) { case FULL_DATE -> { todosStream = todosList . stream ( ) . filter ( o -> IOCase . INSENSITIVE . checkEquals ( query , getDateString ( o . getCreatedAt ( ) , CreatedAtQueryTypes . FULL_DATE ) ) ) ; } case SHORT_DATE -> { todosStream = todosList . stream ( ) . filter ( o -> IOCase . INSENSITIVE . checkEquals ( query , getDateString ( o . getCreatedAt ( ) , CreatedAtQueryTypes . SHORT_DATE ) ) ) ; } case TIME -> { todosStream = todosList . stream ( ) . filter ( o -> IOCase . INSENSITIVE . checkEquals ( query , getDateString ( o . getCreatedAt ( ) , CreatedAtQueryTypes . TIME ) ) ) ; } case DATE_TIME -> { todosStream = todosList . stream ( ) . filter ( o -> IOCase . INSENSITIVE . checkEquals ( query , getCreatedAtDateTimeShort ( o . getCreatedAt ( ) ) ) ) ; } default -> { return queryTodos ; } } todosStream . forEach ( o -> { queryTodos . put ( o . getId ( ) , o ) ; } ) ; return queryTodos ; }
Finds a todo from the todos BidiMap.
Finds a todo from the todos BidiMap .