futurebird, (edited )
@futurebird@sauropods.win avatar

Java has a interface* called “Set” but the documentation is nebulous & ominous. “may throw an exception” what? does no one even know? There isn’t even a method for intersection & union?! What is the point? I taught my students to use the set object in Python. It was an elegant beautiful experience— Thought we could do it in Java but I think I will just use arraylist, write my own damn methods.

I’m biased, but Java is always more annoying like this. ugh. (*this explains part of my confusion)

flexghost,
@flexghost@mastodon.social avatar

@futurebird

ArrayList ain't no replacement for intersection and union

futurebird,
@futurebird@sauropods.win avatar

@flexghost What is an intersection Jack?

zenkat,
@zenkat@sfba.social avatar

@futurebird The functional programming affordances in Python are awesome. Opened my eyes to a while new way of thinking about programming.

futurebird,
@futurebird@sauropods.win avatar

@zenkat Working in Python I hardly need to look at the documentation everything works as I’d expect it to work. With Java it’s combing through documents and reading acerbic stack exchange posts— giving up and coding something I suspect must have a dead simple implementation I can’t find. It looks ugly as sin. Then I find the short cut and wonder who would name it like that. I suppose someone must find this “beautiful and obvious” but it’s not me.

barrygoldman1,
@barrygoldman1@sauropods.win avatar

@futurebird the set operations are insane (python) with them u can write one liners that woulda taken 10s of miinutes or more of thinking and coding up a dozens of lines of code in older languages without it.

albertcardona,
@albertcardona@mathstodon.xyz avatar

@futurebird

In Java, "Set" is an interface. What you are looking for is a "HashSet" https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html or any other class that implements the interface "Set" like a TreeSet, LinkedHashSet, CopyOnWriteArraySet, EnumSet, and others, such as a Map's key set.

dr2chase,
@dr2chase@ohai.social avatar

@futurebird Isn't it (technically) an "interface", not a "class"? Not helping with the annoying, but the reason it feels underspecified is that it wants to allow very simple things to be sets, and so the requirements are as loose as possible.

futurebird,
@futurebird@sauropods.win avatar

@dr2chase I think you are correct. That makes more sense. There has to be utility that just does sets like in math somewhere, right?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • rosin
  • everett
  • GTA5RPClips
  • DreamBathrooms
  • magazineikmin
  • Youngstown
  • khanakhh
  • slotface
  • thenastyranch
  • InstantRegret
  • Durango
  • mdbf
  • kavyap
  • ngwrru68w68
  • megavids
  • ethstaker
  • modclub
  • osvaldo12
  • tacticalgear
  • vwfavf
  • cubers
  • tester
  • normalnudes
  • Leos
  • cisconetworking
  • anitta
  • provamag3
  • JUstTest
  • All magazines