So my problem is that I wrote a function that takes two doubles, two Int objects, and a Calendar object on Android (Java). I believe that the class provided to run in a separate thread, AsyncTask, accepts only one type of object (but allows several) as an argument, so I decided that I could put it in a list or LinkedList or something like that.
Is there a type that allows you to use several data types ( Double, Double, Int, Int, Calendar ), or do I need to create my own class of objects? I am a newbie programmer, so itβs less difficult, probably better, but I am also interested in a better solution.
What the function does is take a location ( double latitude, double longitude ), a couple of options in the form of integers and a calendar object. It takes the location, parameters, and date, and then returns the sunrise time object (or sunset, depending on the parameters) for that location. Thanks for the tips, and I understand that it would be better to create a special class of objects and just pass this or override the background thread class, but I'm pretty new to object-oriented programming, so the less overhead, the better (for currently )
(Update). After much work, it became easier to create a data type class and just use it. The correct path turned out to be easier in the end. Who thought.
source share