You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
4、I personally thought this was elegant so I was looking to see if there was something like this in Go, until I discovered this framework. I looked at the examples and found that the methods in them were not only very similar, so I tried to write them in Java.But unfortunately I just got the following code
Is this framework capable of doing the same as java? If so, could you please provide examples or where they appear?
If not, is there a serious mistake in my writing method? How can I write it so that it can be almost as efficient as the first writing method? Please give an example.
The text was updated successfully, but these errors were encountered:
wayddmldbzz
changed the title
Some advice on how to use it
Discussion on how to use
Oct 9, 2023
Hey, @wayddmldbzz,
Thank you for your interest in this framework. Your stream-based Java-example looks nice.
The Java DSL uses an important language feature. Stream interface approximately looks like this:
Unfortunately, to my knowledge Go does not support this kind of interfaces.
The only similar feature that I was able to find was to use plain functions that can take generic parameters:
funcMap[T, R](Stream[T], func(T)R)
Hence, the nice Java-style DSL seems to be infeasible in the current version of Go.
Your code looks almost right. In order to make it nicer, I would make a small refactoring:
1、First I have a struct
2、If I have an array of this struct, I hope to do some processing on it and get a map, I can write like this
3、If the same structure is put into java, I can write it like this, and the efficiency should be similar to the above, I think it's elegant
4、I personally thought this was elegant so I was looking to see if there was something like this in Go, until I discovered this framework. I looked at the examples and found that the methods in them were not only very similar, so I tried to write them in Java.But unfortunately I just got the following code
So I want to ask:
The text was updated successfully, but these errors were encountered: