Skip to content
Advertisement

Regex to validate that every digit is different from each other

I have to validate strings with specific conditions using a regex statement. The condition is that every digit is different from each other. So, 123 works but not 112 or 131. So, I wrote a statement which filters a string according to the condition and prints true once a string fullfies everything, however it only seems to print “true” altough

Complex logix in Java Comparator

I have a list of actors where each actor has a type (“Artist”, “Producer”, “Mixer”…some other types). I need to order this list taking the following into consideration: Actors with the type of “Artist” will be displayed first. Actors with the type of “Producer” will be displayed next. Actors with the type of “Mixer” will be displayed next. All actors

how do I make while loop run until a certain input is placed?

the idea is basically the loop takes in input and it runs until I type “quit” but it doesn’t work the way I want to and I can’t figure out why 🙁 (p.s. im a beginner that came from python pls be kind) I also tried adding a temporary variable so that the while loop could check the condition before

How to convert String to Json Object in java or groovy

I saved a json into the database as a string like this: “[_district:_1_2_5village, _name:_1_1_2id_inter, _gender:_1_3_5sex]” Now i want to convert it back to a Json Object so as to pick the key and value eg _district is the key and _1_2_5village is the value. Any help on how i can achieve this. Thanks I tried to convert the string back

How can I shorten many while loops?

This is one of my first attempts to use Java and I tried my best, but I need to shorten it so it’s not so long. Important is that it keeps all the coins of the Euro. It’s a German code so geld means money. This part of the code System.out.println(rgeldt + ” mal 2 Euro”); just means how often

Spring @Transactional with base and subclasses

I am confused about @Transactional annotation with base and subclasses. I have the following code with several generic subclasses derived from the base class CustomRepository<T> which implements ICustomRepository<T>. I want all the methods of the interface ICustomRepository<T> be transactional. Is it enough to put @Transactional just in the base class so that the call findAll() from sublasses also become transactional.

Advertisement