Skip to content

Commit

Permalink
Convert to Kotlin to fix the packaging error
Browse files Browse the repository at this point in the history
  • Loading branch information
tiann committed Oct 9, 2023
1 parent a7b6af7 commit 6051592
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/main/kotlin/MaxSizeHashMap.kt
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
import java.util.LinkedHashMap;
import java.util.Map;

/**
* @author weishu
* @date 2023/10/9.
*/
public class MaxSizeHashMap<K, V> extends LinkedHashMap<K, V> {
private final int maxSize;

public MaxSizeHashMap(int maxSize) {
this.maxSize = maxSize;
}

@Override
protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
return size() > maxSize;
class MaxSizeHashMap<K, V>(private val maxSize: Int) : LinkedHashMap<K, V>() {
override fun removeEldestEntry(eldest: Map.Entry<K, V>): Boolean {
return size > maxSize
}
}

0 comments on commit 6051592

Please sign in to comment.