Best practice for returning multiple values in Java?

前端 未结 7 1197
走了就别回头了
走了就别回头了 2020-12-05 17:31

Today I\'ve added a extra security check behind my login forms, to slow down brute force attacks. I\'ve got multiple login forms and made a nice easy to call function that d

7条回答
  •  春和景丽
    2020-12-05 18:27

    You can return an Object[] array, java autoboxes so its more easy to use. If it's just for a short distance handover, why not. Ofc its risky, possible class cast trouble, nullchecks etc

    but its easy to write and use.

    then again, a static inner class is quickly created and if you put it right next to the method returning it, you also know where to find it (usually near the origin)

提交回复
热议问题