Comment by M. Prokhorov on Mocking object in set
It seems like you don't mock the new B() and instead you create an actual instance of it. Would I be correct in this observation? If I am correct, then it's no surprising it doesn't behave exactly...
View ArticleComment by M. Prokhorov on Removing a hard Enter from a String
\r\n is not the only possible variant. It could be just one \n char in there. But also - if you aren't getting the correct output - what DO you get?
View ArticleComment by M. Prokhorov on Change xjc generated Java field name from 'value'...
Does this answer your question? XSD: Specifying a name for a text node property
View ArticleComment by M. Prokhorov on How to generalize a comparison in Java code
I would argue that naming things may still be helpful in reading the code later. Perhaps, defining interface Filter extends Predicate<Earthquake> is the best of both worlds.
View ArticleComment by M. Prokhorov on Flux.zip with repeated empty Mono leads to endless...
From my understanding or the doc, Repeat operation wraps the original Mono to do onSubscribe as soon as the original Mono does its onComplete. The Empty mono only ever calls onComplete. So what you get...
View ArticleComment by M. Prokhorov on Which of the several sessions waiting to acquire...
@Baalback, so in other words, there is a linked list of waiters to notify. Because my two new sessions start concurrently, it's undefined which one of them will get the lock next, but any other session...
View ArticleComment by M. Prokhorov on Unzip specific file from inputstream into another...
You can't put files into an Outputstream, that's a misnomer. InputStream represents the contents of the file, not the file itself. If you want to have a particular output file in the end, that is not...
View ArticleComment by M. Prokhorov on Which of the several sessions waiting to acquire...
By "queue", do we mean a list of strict ordering, where there can only be one "next", which is chosen at the time of adding to the queue? I'm asking because some programming platforms have unordered...
View ArticleComment by M. Prokhorov on How to close HttpClient? Why there is no .close()...
HttpResponse.BodySubscriber talks about closing underlying connections, but there doesn't seem to be any way of explicitly doing so for now, as stated with the Holger's answer.
View ArticleComment by M. Prokhorov on Hibernate Constraint Primary Key
The main property of any primary table key is its uniqueness within the owning table. Your expressed intent with "having two rows with the same primary key" contradicts this property, so you can't do...
View ArticleComment by M. Prokhorov on Can i put not null constraint to FK?
We can't really design your system for you, because we don't know full spec of it. What is the specific perceived problem you are trying to solve? Why not indeed simply make it a non-null FK?
View ArticleComment by M. Prokhorov on Java stream an array list and compare with...
You are not avoiding loops by using streams - you just move the loop into the streams library. It's still going to be there, just not as visible and harder to debug.
View ArticleComment by M. Prokhorov on intellij-internal error-buil error in java
Did you read what the error says? Did you do what is suggested by the error message?
View ArticleComment by M. Prokhorov on How can I interpret this error? Required type:...
The error message you got refers to java's type system. As stated in the answer below, the compiler expects you to pass a Supplier<R> into the method. You passed Collector<T, A, List>, and...
View ArticleAnswer by M. Prokhorov for How can I change the stream my event uses via the...
Live broadcast is associated with a stream using a liveBroadcasts/bind method.In terms of Java API it would look something like this:YouTube yt = ... // your reference to YouTubeString broadcastId =...
View ArticleAnswer by M. Prokhorov for Thymeleaf - Unquoting a part of inline JavaScript...
[[...]] notation is used for escaped inlining: it converts everything inside into a well-formed Javascript string.Since you also want to call something, you need un-inlined version, using [(...)]...
View ArticleAnswer by M. Prokhorov for What's the point of @Before and @BeforeClass?
@BeforeClass method runs whenever a static initializer block runsThe important caveat here is that this statement is wrong. Static initializer block runs when the class is loaded, which is not...
View ArticleAnswer by M. Prokhorov for java.lang.IllegalArgumentException: fromIndex(x) >...
This exception happens because when computing start of your slice you don't take into consideration how many objects are there in full list of candidates.If I request from your method a page 1 of size...
View ArticleAnswer by M. Prokhorov for Chain optionals with void return type
I'm just going to start by saying: cleanest solution would require a better abstraction than Optional provides, because it's main purpose is to represent a missing value, not validation output.However,...
View ArticleAnswer by M. Prokhorov for Can't find the right screen dimension
You are querying an application area size, which might not take up the entire screen size. From Display class docs:The application display area specifies the part of the display that may contain an...
View Article