1.0.0 • Published 6 months ago

javascript-implementation-of-java.util.treemap-class-master v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

JavaScript-implementation-of-java.util.TreeMap-Class

This library implements the java.util.TreeMap Class and some of it's popular methods using JavaScript. This library can be imported and used in your JavaScript projects, where you may need or want to use TreeMap<Key, Value>(). Learn more about java.util.TreeMap Class from here: https://www.tutorialspoint.com/java/util/java_util_treemap.htm

How to utilise TreeMap<Key, Value>() in your JavaScript projects

Just import/include the treeMpa.js file in your project and you are good to go.

Use something like this:

<html>
<script src = "treeMap.js"></script>
</html>

Using TreeMap in you JavaScript projects

Initialise a TreeMap in your code like this:

 var myTreeMap = new TreeMap();
 

Adding new key, value to your TreeMap variable:

myTreeMap.put(1,"First Value");
myTreeMap.put(2,"Second Value");
myTreeMap.put(3,"Third Value");
myTreeMap.put(4,"Fourth Value");

List of methods of TreeMap Class implemented in this library:

  • Value put(K key, V value)
  • Value get(Object key)
  • Key firstKey()
  • Key lastKey()
  • boolean containsKey(Object key)
  • boolean containsValue(Object value)
  • Value remove(Object key)
  • void clear()
  • Key floorKey(K key)
  • Key ceilingKey(K key)
  • Object clone()
  • int size()
  • Set keySet()
  • void treeMap.foreach(V value)
  • boolean isEmpty()
1.0.0

6 months ago