Pandemic Posted October 28, 2014 Posted October 28, 2014 Boolean.toString(true) and Boolean.parseBoolean("true")?
NotoriousPP Posted October 28, 2014 Posted October 28, 2014 Changelog: -Added Utilities method textToBoolean(String) -Added Utilities method booleanToText(Boolean) Umm.... booleanToText(Boolean) == (Boolean.toString(Boolean) || (Boolean+"")) textToBoolean(String) == Boolean.parseBoolean("true"); 1
Alek Posted October 28, 2014 Author Posted October 28, 2014 Umm.... booleanToText(Boolean) == (Boolean.toString(Boolean) || (Boolean+"")) textToBoolean(String) == Boolean.parseBoolean("true"); parseBoolean uses equalsIgnoreCase and I wanted to make matching methods. If it's really that big of a deal I can remove it. Just figured I would make a small private method public. From the API: It's pretty much identical..
NotoriousPP Posted October 28, 2014 Posted October 28, 2014 parseBoolean uses equalsIgnoreCase and I wanted to make matching methods. If it's really that big of a deal I can remove it. Just figured I would make a small private method public. You need to look at the default method first. Your method is completely redundant.
Alek Posted October 28, 2014 Author Posted October 28, 2014 Read my post above yours, I edited it. I know what the default method looks like, that's why I made mine. If it's really that big of a problem I'll just make it private again.
NotoriousPP Posted October 28, 2014 Posted October 28, 2014 Read my post above yours, I edited it. I know what the default method looks like, that's why I made mine. If it's really that big of a problem I'll just make it private again. I'm not saying that it is a problem, just useless at best. There is no reason for it to public or even be private for that matter, when you can achieve the same by using the default methods, with the added benefit of less lines of code. Not trying to put you down, just being a critic.
Alek Posted October 28, 2014 Author Posted October 28, 2014 I'm not saying that it is a problem, just useless at best. There is no reason for it to public or even be private for that matter, when you can achieve the same by using the default methods, with the added benefit of less lines of code. Not trying to put you down, just being a critic. booleanToText is identical, but it was only to match textToBoolean. I wanted to assess that the string was in fact "true" without manipulation. Therefore putting it to lowercase first or toString() wasn't viable. The only reason why I mentioned it is because all API additions/changes go into the changelog. For the average person yes, it's really not needed. Edit: I'll update API documentation to make it a little bit less confusing and remove booleanToText on the next update.
cashmoneytyrone Posted October 29, 2014 Posted October 29, 2014 Awesome man, 3 minutes is completely fair. Thanks for the update! 1