Skip to content
Advertisement

Tag: java

Can’t implement string output

It is not possible to display the string correctly by condition If the coffee machine has enough supplies to make the specified amount of coffee, the program should print “Yes, I can make that amount of coffee”. If the coffee machine can make more than that, the program should output “Yes, I can make that amount of coffee (and even

password validation regex java

i have used regex for password validation. i am using servlet for this validation but there is some issue arising. this method isnt working. it returns all the errors even if some conditions are satisfied. help! if anything else reqd i will add it just ask. input – expected output – actual output – Answer Your pattern are incomplete. Add

How get all results from github search api?

I need to get all results with github search api with pagination using. Now I use request: https://api.github.com/search/repositories?q=lib&page=1&per_page=20 I read that the responses also includes the Link header which contains a ready-made URL to the next page. In response I have link https://api.github.com/search/repositories?q=lib&page=2&per_page=20> and link to the last page: https://api.github.com/search/repositories?q=java&page=50&per_page=20 But I don’t understand how can I to implement transition

Testing a Spring ControllerMethod using Mockito which alters an entry in the db with Optional.map NullPOinterException

Im currently Testing my Controller methods. In one Method I add a Reisepunkt(travelpoint) to a Reise(travel), which is already saved inside a database. Using the generated-request.http API I can use the method to make entrys into the db. Now i wanted to write a test method just so I can get the hang of it. I always get a NullPointerException

ClassNotFoundException thrown

I have an issue with my program for a project assignment throwing multiple ClassNotFoundException. I think the problem stems from the BaseGear class, which is the abstract super class for all items in the game. Each item must be restricted by class so in the constructor the string restrict is provided as an argument which I then try and convert

How to flatten dynamic yaml file using java

I want to parse dynamic yaml files using java into HashMap and access them using dot syntax (i.e “a.b.d”) Given the following example.yml: And can fetch it as Any idea How we can achieve this? Answer As Thorbjørn said in a comment, a HashMap is probably not the correct data structure for representing a YAML file. You should try looking

Implementing List interface for CustomList in Java

I need to create a custom list that adds elements in pairs. I copied a similar implementation and adjusted it as needed, but unfortunately, it doesn’t work. And I have this for testing my code so far. The problem is that when I call add method the size of the list increases by 2 as it should, but nothing is

Advertisement