gsunnic
gsunnic

Reputation: 321

Javacard Collections

I have been looking through the JavaCard API and examples and could not find any reference to higher level data collections like List, ArrayList, HashMaps and the likes ?

Am I missing something ?

I am aware that JavaCard environments are very limited in resource and the JVM must be as tiny as possible but the lack of some form of easy to use data collection objects can make processes rather manual.

Upvotes: 2

Views: 983

Answers (5)

Ambesh Kumar
Ambesh Kumar

Reputation: 23

It depends which of java card api version you are using, Up to java card 2.2.2, Higher level data collections are not available, but from java card 3.0(classic or connected) in both, you can use most of your higher level data collections. you can find more detail on here

Upvotes: 0

user4935264
user4935264

Reputation: 46

Javacard is a very small subset of the Java it only support

Boolean, byte, short Int keyword is optional A one-dimensional array Java packages Classes and interfaces abnormal inheritance polymorphism

overloading

not support Long, double, float, and all the wrapper classes Char, String Multidimensional array Dynamic class loading The safety management Finilize method thread serialization Clone method

Upvotes: 0

Deepak Arya
Deepak Arya

Reputation: 74

Collection / Hash Map / String / Mutithreading / 2D Array / Garbage Collection finalize() are not supported by Java Card architecture. In java card, there is only byte/short type of array available to use . Supported Data Types are boolean / Byte / Short / Integer(supported on some platforms)

Upvotes: 0

CodeLikeNoonesBusiness
CodeLikeNoonesBusiness

Reputation: 677

There is no collection in JCVM. In javacard, there is only byte/short array for you to use; additionally, 2-dimension(and above) array is also not supported.

you will have to design and implement your own data structure for complex data storage.

Good luck.

Upvotes: 1

vojta
vojta

Reputation: 5651

You are right, there are no collections like List, ArrayList or HashMap in JavaCard API. Arrays are all you have - you can implement your own ArrayList if it is necessary. There is no String either, after all.

JavaCard is not Java, although the name can be confusing. Coding in JavaCard is very low-level. You should take JavaCard rather as the assembler with Java syntax.

Upvotes: 5

Related Questions