Skip to content

Commit 8b07bf7

Browse files
javaqueryVicky Thakor
authored andcommitted
fix: code optimization
1 parent e7d5675 commit 8b07bf7

File tree

7 files changed

+14
-16
lines changed

7 files changed

+14
-16
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ plugins {
55
}
66

77
group 'com.javaquery'
8-
version '1.0'
8+
version '1.0.1'
99

1010
repositories {
1111
mavenCentral()
1212
}
1313

1414
dependencies {
15-
implementation('org.slf4j:slf4j-api:1.7.30')
15+
implementation('org.slf4j:slf4j-api:+')
1616
testImplementation('org.junit.jupiter:junit-jupiter:5.7.0')
1717
}
1818

src/main/java/com/javaquery/util/collection/Collections.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ private Collections() {
2525
* @return {@code true} if the provided Collection [List, Set] is {@code null} or empty
2626
* otherwise {@code false}
2727
*/
28-
public static boolean nullOrEmpty(Collection collection) {
28+
public static boolean nullOrEmpty(Collection<?> collection) {
2929
return Objects.isNull(collection) || collection.isEmpty();
3030
}
3131

@@ -37,7 +37,7 @@ public static boolean nullOrEmpty(Collection collection) {
3737
* @return {@code true} if the provided Collection [List, Set] is non-{@code null} and non-empty
3838
* otherwise {@code false}
3939
*/
40-
public static boolean nonNullNonEmpty(Collection collection) {
40+
public static boolean nonNullNonEmpty(Collection<?> collection) {
4141
return Objects.nonNull(collection) && !collection.isEmpty();
4242
}
4343

@@ -49,7 +49,7 @@ public static boolean nonNullNonEmpty(Collection collection) {
4949
* @return {@code true} if the provided Map is {@code null} and empty otherwise
5050
* * returns {@code false}
5151
*/
52-
public static boolean nullOrEmpty(Map map) {
52+
public static boolean nullOrEmpty(Map<?, ?> map) {
5353
return Objects.isNull(map) || map.isEmpty();
5454
}
5555

@@ -61,7 +61,7 @@ public static boolean nullOrEmpty(Map map) {
6161
* @return {@code true} if the provided Map is non-{@code null} and non-empty
6262
* otherwise {@code false}
6363
*/
64-
public static boolean nonNullNonEmpty(Map map) {
64+
public static boolean nonNullNonEmpty(Map<?, ?> map) {
6565
return Objects.nonNull(map) && !map.isEmpty();
6666
}
6767

src/main/java/com/javaquery/util/io/Files.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public final class Files {
2929
* Note: Exception is logged not thrown.
3030
*
3131
* @param file - file to create
32-
* @param <T>
32+
* @param <T> the type of class that extends {@link File}
3333
* @return <code>true</code> if the named file does not exist and was
3434
* successfully created; <code>false</code> if the named file
3535
* already exists
@@ -54,7 +54,7 @@ public static <T extends File> boolean createNewFile(T file) {
5454
* Note: Exception is logged not thrown.
5555
*
5656
* @param file - file to delete and create
57-
* @param <T>
57+
* @param <T> the type of class that extends {@link File}
5858
* @return <code>true</code> if the named file deleted and was
5959
* successfully created; <code>false</code> if the named file
6060
* already exists
@@ -75,7 +75,7 @@ public static <T extends File> boolean deleteAndCreateNewFile(T file) {
7575
*
7676
* @param file file to write
7777
* @param data data to write to file
78-
* @param <T>
78+
* @param <T> the type of class that extends {@link File}
7979
*/
8080
public static <T extends File> void writeToFile(T file, String data) {
8181
Assert.nonNull(file, NullPointerException::new);
@@ -100,7 +100,7 @@ public static <T extends File> void writeToFile(T file, String data) {
100100
* @param data data to append to file
101101
* @param appendNewLine <code>true</code> to append new line at the end of data
102102
* otherwise <code>false</code>.
103-
* @param <T>
103+
* @param <T> the type of class that extends {@link File}
104104
*/
105105
public static <T extends File> void appendToFile(T file, String data, boolean appendNewLine) {
106106
Assert.nonNull(file, NullPointerException::new);
@@ -122,7 +122,7 @@ public static <T extends File> void appendToFile(T file, String data, boolean ap
122122
* Note: Exception is logged not thrown.
123123
*
124124
* @param file file to read
125-
* @param <T>
125+
* @param <T> the type of class that extends {@link File}
126126
* @return String data of file if exists otherwise <code>null</code>
127127
*/
128128
public static <T extends File> String readFromFile(T file) {
@@ -141,7 +141,7 @@ public static <T extends File> String readFromFile(T file) {
141141
* Path of file provided
142142
*
143143
* @param file file to get {@link Path}.
144-
* @param <T>
144+
* @param <T> the type of class that extends {@link File}
145145
* @return {@link Path} of file
146146
*/
147147
private static <T extends File> Path getPath(T file) {

src/main/java/com/javaquery/util/time/DatePattern.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public enum DatePattern {
3535
MMM_DD_YYYY("MMM dd, yyyy"),
3636
E_D_M_Y_HMS("EEE, dd MMM yyyy HH:mm:ss +0000");
3737

38-
private String value;
38+
private final String value;
3939

4040
DatePattern(String value) {
4141
this.value = value;

src/main/java/com/javaquery/util/time/Dates.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public enum Month {
224224
11), DECEMBER(12);
225225

226226
private final static Calendar calendar = Calendar.getInstance();
227-
private int value;
227+
private final int value;
228228

229229
Month(int value) {
230230
this.value = value;

src/test/java/com/javaquery/util/collection/TestCollections.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import org.junit.jupiter.api.Test;
55

66
import java.util.ArrayList;
7-
import java.util.Arrays;
87
import java.util.HashMap;
98
import java.util.HashSet;
109
import java.util.List;

src/test/java/com/javaquery/util/io/TestFiles.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.javaquery.util.io;
22

3-
import com.javaquery.util.Assert;
43
import org.junit.jupiter.api.Assertions;
54
import org.junit.jupiter.api.Test;
65

0 commit comments

Comments
 (0)