Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Something similar to java.util in Javascript?

Tags:

javascript

I think Javascript is a fantastic language. I like all the little peculiarities, the inheritance model, the lack of classes, etc. Because of this I have never wanted to learn a framework as all of the ones I've looked at (jQuery, MooTools, Prototype, Dojo) force you to change how you write your code, in many cases it's not really even Javascript anymore.

Yet, I feel the same frustration every time I have to implement something as fundamental as a hash table or a linked list. Sure, I write it once and never again, but given how many times these structures have been coded by other people before me I really shouldn't have to.

Are there any "pure" Javascript libraries that will give you a bunch of basic data structures and utilities, similar to what you find in java.util? Again, I don't want anything that changes the way I code, I want to use these objects within vanilla Javascript.

Thanks

like image 262
Andreas Jansson Avatar asked Feb 22 '10 23:02

Andreas Jansson


People also ask

Is Java code similar to JavaScript?

JavaScript(JS) is not similar or related to Java. Both the languages have a C-like syntax and are widely used in client-side and server-side Web applications, but there are few similarities only.

Can JavaScript use Java classes?

22.3. Using Java Classes Directly. As described in the previous two sections, both Netscape and Internet Explorer allow JavaScript code to interact with Java applets and Java applets to interact with JavaScript.

Are there pairs in JavaScript?

But to my knowlege there is no dedicated pair object in the Javascript language.


1 Answers

Google's Closure library has lots of data structures in it. The API documentation is at http://closure-library.googlecode.com/svn/docs/index.html (check the goog.structs "package").

like image 168
Matthew Crumley Avatar answered Sep 18 '22 13:09

Matthew Crumley