Java overloaded constructor force int parameter?

Try Matrix m = new DefaultSparseIntMatrix((int) (vertices. Length*50), new long{vertices. Length,vertices.

Length}) the vararg is syntactic sugar for an array and it also allows passing in an array directly.

Try Matrix m = new DefaultSparseIntMatrix((int) (vertices. Length*50), new long{vertices. Length,vertices.

Length}); the vararg is syntactic sugar for an array and it also allows passing in an array directly.

Thank you very much! Works for me! – floorish Nov 6 at 22:24 1 @EJP dude it does, and do you mind if you stop trolling me – ratchet freak Nov 6 at 22:26 If you actually believe this is trolling I suggest you report it.

– EJP Nov 6 at 22:30.

Calling a function with a list of longs, or an int followed by a list of longs, is just asking for trouble, especially because java will automatically cast an int into a long for you. (In other words, what you have passed into that constructor would work for either one). If you are dead set on this parameter pattern (which I strongly suggest you change), You are going to have to take in type Integer (as opposed to type int), and explicitly pass in an Integer object into the function.In otherwords, try this: DefaultSparseIntMatrix(Long... size) and DefaultSparseIntMatrix(Integer maximumNumberOfEntries, Long... size).

I know, but I can't change the package, just have the jar. However Integer doesn't work either unfortunately, still ambiguity error... Thanks for the answer anyway – floorish Nov 6 at 22:24 Yup, if you only have the jar, your best bet is ratchet freak's idea. That's a terrible design of parameters though.

– Leif Andersen Nov 7 at 0:01.

I would use the builder pattern and use something like this, which is as easy to use as a constructor and clearer in its purpose: Matrix m = new DefaultSparseIntMatrixBuilder(). WithMaxNumberOfEntries(vertices. Length * 50) .

WithSize(vertices. Length, vertices. Length) .build(); The build method calls a private constructor of DefaultSparseIntMatrix with the builder itself as unique argument, and the constructor gets the data from the builder.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions