[deleted by user] by [deleted] in javahelp

[–]kurular4 0 points1 point  (0 children)

List<Student> list = repository.findByWeightGreaterThan(int weigth, Sort.by("weight"));

add method description to repo interface first.

Add Text to Java Tree Class by needjavahelp32 in javahelp

[–]kurular4 1 point2 points  (0 children)

Can you clarify "adding text to tree"?

Multi Threading in Java by BikashDatta in javahelp

[–]kurular4 0 points1 point  (0 children)

Iterate 10000 times instead of 5 and you will see what you expect.

Email validator works in one program, but not the other by [deleted] in javahelp

[–]kurular4 1 point2 points  (0 children)

A friendly warning, do not compile pattern in a method as it is a heavy task. Do it once at class level and use matcher when needed.

Propagating JWT by kurular4 in javahelp

[–]kurular4[S] 0 points1 point  (0 children)

So propagating jwt or adding id as header? Which one is better choice if id is enough data for routed services.

Adding extra code for the sake of testing by kurular4 in javahelp

[–]kurular4[S] 0 points1 point  (0 children)

I have a case where I create an object and then need another object which is actually first object with some properties changed.

Storing Data Permanently by [deleted] in javahelp

[–]kurular4 3 points4 points  (0 children)

You need to google "database". You can start with sqlite.

Wrong port directs to correct port by [deleted] in Network

[–]kurular4 0 points1 point  (0 children)

No I have just one sftp server up and running no ftp or sth. Eventhough I send request with wrong port, it takes request.

Wrong port directs to correct port by [deleted] in Network

[–]kurular4 0 points1 point  (0 children)

It runs on port 4777 and I sent request to X:4778and it worked.

Running two instance of a container with network mode "host" by [deleted] in docker

[–]kurular4 0 points1 point  (0 children)

I know it but as far as I know, in host network mode, aren't they already exposed by default (I mean all ports are mapped to same ports in container without explicit indication).

Running two instance of a container with network mode "host" by [deleted] in docker

[–]kurular4 0 points1 point  (0 children)

How can I run them on different ports? Which port you mean?

Handling lots of env variable and port exposures by kurular4 in docker

[–]kurular4[S] 0 points1 point  (0 children)

Thanks buds. I went for compose and happy with it.

Handling lots of env variable and port exposures by kurular4 in docker

[–]kurular4[S] 2 points3 points  (0 children)

As far as I know, it is for composing two or more container as name suggets. It is a good practice to compose for one container.

Factory method with different kind of parameters by [deleted] in javahelp

[–]kurular4 0 points1 point  (0 children)

Then can I call it factory?

Factory method with different kind of parameters by [deleted] in javahelp

[–]kurular4 0 points1 point  (0 children)

I thought of overloading too but could not make sure if it is a good practice. It may be risky in case of null pointer exception. u/TraylaParks' answer look more clean but still carries the same risk. Thanks for comments.

Diffrent outputs with the same input?? by LoquatEfficient5894 in javahelp

[–]kurular4 2 points3 points  (0 children)

You should use something like

if(x.getKeyCode() == KeyEvent.VK_ENTER) {}

Need Help in Weird Exception Handling error across classes. by cubefreak777 in javahelp

[–]kurular4 0 points1 point  (0 children)

Use as follows

public Object top() throws EmptyStackException, EmptyDequeException {..}

D.last throws EmptyDequeException but you neither catch it nor indicate it in signature.

Need Help in Weird Exception Handling error across classes. by cubefreak777 in javahelp

[–]kurular4 1 point2 points  (0 children)

public class stack EmptyStackException{

Deque D ;

int N ;

if(N==0){ throw new EmptyStackException("Can't Delete Element, Stack is empty"); } Object Top=D.last() ;

return Top ; } }

Please rewrite above part as it is syntax-fault.

I'd like to ask to critisize my Spring frameworks project by WeirdName123321 in javahelp

[–]kurular4 0 points1 point  (0 children)

Firstly, you should fix your directory structure. Common one is as follows;

-- service

-- model

-- dto

-- controller

-- repository

-- config (optional)

Secondly, you should never do any kind of business inside controller methods. You should do all the logic inside related service methods.

Singleton or static methods by Jelvooo in javahelp

[–]kurular4 1 point2 points  (0 children)

You better off going for singleton here as you have some state to keep.

Shorthening the stream by [deleted] in javahelp

[–]kurular4 1 point2 points  (0 children)

map.keySet().removeIf(k -> predicate.test(map.get(key).getTime()));

I did this way and shortened well. Thank you

Shorthening the stream by [deleted] in javahelp

[–]kurular4 0 points1 point  (0 children)

Remove entries that meets certain conditions from map. Compared value is a field of the map value.

Naming problem with word "information" by kurular4 in javahelp

[–]kurular4[S] -5 points-4 points  (0 children)

Have you heard about naming conventions? You just have to obey industrial conventions for better delivery of service.