Java class specialization for double and floating precision

I was wondering if anyone can help me with providing options for double and floating precision for the class, please?

I work with Java3D and the API specification for Point3d and Point3f, I understand that the implementation effectively duplicates the Point3f class, replacing the float with two if necessary. Is this because Generics cannot be used with primitive data types? Efficiency?

I am writing a Curve class, and I am wondering if I should provide Curved and Curvef in a similar way. This is the best variant?

+5
source share
2 answers

Yes, unfortunately, Java generics do not work with primitive types.

, java .

Java 8 , IntFunction. .

+5

, - . Object, Double Float ( ).

Curve , double/float. , doubleValue() floatValue(). , , . , Curve, , .

+1

All Articles