Javscript/TypeScript: Find the key and append value as an array

I have an object which is like [{ Date: 01/11/2022, Questionnaire: [ {Title: ‘Rating’, Ans: ‘5’ }, {Title: ‘Comment’, Ans: ‘Awesome’ } ] }, { Date: 01/11/2022, Questionnaire: [ {Title: ‘Rating’, Ans: ‘2’ }, {Title: ‘Comment’, Ans: ‘Bad’ } ] }, { Date: 09/12/2022, Questionnaire: [ {Title: ‘Rating’, Ans: ‘3’ }, {Title: ‘Comment’, Ans: ‘Okay’… Read More Javscript/TypeScript: Find the key and append value as an array

how to write method/function named movel( s, k) that moves all the elements of the 's' array to the left by 'k' positions (not rotate)?

this is my code below and please help me find out the the expected output[ 4,5,6,0,0,0] def movel(s, k): n=len(s) j=0 n_arr=s[:k] return (s[k::]+n_arr[::]) for j in range(0, n): print(s[j], end=’ ‘) s=[1,2,3,4,5,6] k=3 movel(s,k) *Output : [4,5,6,1,2,3] * >Solution : You could do use index slicing def movel(s, k): if k > len(s): return… Read More how to write method/function named movel( s, k) that moves all the elements of the 's' array to the left by 'k' positions (not rotate)?

App crashes when adding to an ArrayList in a for loop after first succeeful add

Still new to android and java but getting there, here is my problem. The crash occurs at this point fieldsA.add( A.substring(_start, _a[i])); it works the first time but not the second time, I do not get an error in my debug window, just a crash. // number of chars to extract from string value to… Read More App crashes when adding to an ArrayList in a for loop after first succeeful add

How to filter a list with common string and group to a new list

I have a List<String> which consist of a json string. example below has 5 items in the list. Is there any simple way to extract common class (ex. Biology, Mathematics, History) from the list and group it and create a new List for all the common class. {"name":"Alex","age":"31","class":"Biology","parents":{"father":"Robert","mother":"Mary"}} {"name":"John","age":"34","class":"Mathematics","parents":{"father":"Remi","mother":"Maya"}} {"name":"Rita","age":"27","class":"History","parents":{"father":"Shankar","mother":"Anita"}} {"name":"Sonia","age":"27","class":"Biology","parents":{"father":"Mathew","mother":"Lucy"}} {"name":"Caroline","age":"29","class":"Mathematics","parents":{"father":"David","mother":"Christine"}} expected: List newList1… Read More How to filter a list with common string and group to a new list

How to wrap object in array in java?

I’m making a code to send data to the payment gateway. I am a beginner in using java. I’m having a bit of trouble working with objects in an array in the item_details parameter. I’ve made the code as below. public KeyValuePair<String, String> requestSnapToken(String orderNo, BigDecimal grossAmount, int paymentMethodId, String firstName, String email, List<FormCartLine> itemDetails… Read More How to wrap object in array in java?