Lisa Austin

Ranch Hand
+ Follow
since Jun 04, 2015
Cows and Likes
Cows
Total received
6
In last 30 days
0
Total given
0
Likes
Total received
6
Received in last 30 days
0
Total given
97
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lisa Austin

So I think I may have figured out how to use the find{} with this.   Thank You
1 year ago
I'm trying to learn groovy and spock . I'm wondering if someone could help me with this?

I have a list of maps with key "color" and want to verify each map's value individually.




The key "KeyID" is unique where all other keys can have duplicate values.  When a value is always the same I have used "every{}" to verify the value for a key. Example the value for the key "load" is always 9999.
But what I can't figure out is when the value can be different for a key?  I am wonder if there is a way to reference / filter on the unique value of KeyID first THEN verify the other key for each map?


1 year ago

Zachary Griggs wrote:I compile all my projects in 1.8. Example:

This should work with Java 8. If this is the way your pom is currently setup, then you probably just need to download the SDK.

Locally:
File -> Project Structure -> Project SDK
If the SDK version isn't compatible with java 1.8, you'll see a lot of errors

You should be able to use Java 1.8 with Amazon Coretto Java 8. That would be a change on the machine to install that SDK and use it, probably. I'd imagine it would be on some sort of build server. Do you use Jenkins?



Thank You.  I was just confused I think by what was being asked by my mentor.  Things seem like it should be simple but if it's too simple it seems wrong. LOL.  Thanks for confirming for me.
1 year ago
I hope Beginning Java is okay for this question.  I'm trying to learn Spring and SpringBoot . I have a mentor who has me learning by working on a small project and one task I was given has confused me but I won't meet with him until Friday.  I can email but I just want to run this by someone before I bring it up to him because I think I may have missed something.

I need to change the application's Java version from 1.8 to Amazon Corretto 8.
Maven currently has the maven-compiler-plugin configuration set with source = 1.8 and target = 1.8.

When I was Googling for information about this it looks like this is just set in the project's IDE or I guess the machine it's being built on?  So it's not a POM change ?

https://unix.stackexchange.com/questions/548172/maven-compiler-version-for-amazon-corretto





1 year ago
Thanks guys.  I'll give it a go from this.
1 year ago
I'm on another codewar problem here https://www.codewars.com/kata/54521e9ec8e60bc4de000d6c/train/java

The problem is to find the subset of continuous values which adds up to being the highest value.   The example here is



So the values 4, -1, 2, 1  add up to be the highest value which is 6.
If the int array is all positive then just add up the entire array.
If all negative values then return 0.
If it's an empty array return 0


I think I understand an all positive array, an all negative and an empty.  I figure I would iterate over and test the values as to whether they are all over 0 , all under 0 or empty but if there is a mix of values I'm a bit stumped as to what the best solution is.


I keep thinking of ways that I maybe able to solve this when there is a combination of both positive and negative numbers but most of them seem complicated and most likely NOT the correct way .   Is there any tips someone can give me as to what maybe the best solution?  

On paper I can come up with a few ideas but none seem ideal or when I test the idea I see an issue with it.











1 year ago

Junilu Lacar wrote:Line 13 accesses the parameter b directly and since Arrays.sort() does so in place, the array in the calling code will experience the side effect of being sorted after the call is made. That is, if the array b is unsorted before the call to comp(), it will be sorted after. That's kind of a no-no since it's a side-effect that you wouldn't normally expect to happen nor necessarily want to happen.



So to not access the parameter b directory then I need to create a new int[] array and assign it the value b before sorting?
1 year ago

Junilu Lacar wrote:

Lisa Austin wrote: I was thinking mine maybe better because I'm checking for more than just null arrays?


Your code actually gives incorrect results per this requirement: "If a or b are nil (or null or None), the problem doesn't make sense so return false."

Your code will return true if a and b are null.



Interesting.  I didn't catch that requirement AND I passed all the tests .  I probably should report it to CodeWars.  Thank you for pointing it out to me.
1 year ago

Campbell Ritchie wrote:Isn't it a quicksort for an int[]? In which case wouldn't the memory requirement be the same as that for the original array?
I think trying to find whether two arrays are anagrams of each other can readily be done by sorting. Probably a simpler and therefore less error‑prone solution than some others. What solutions did other people propose themselves?



My solution ( but slightly different ) was voted as best practice but the discussion about how sorting isn't cheap was under it.  Then it was discussed under the second most "Best Practice" and a suggestion to use a HashMap or a non-comparative sort such as Radix Sort .    

What do you think of my solution vs the first place "Best Practice" ?  It's similar I know so maybe not much can be said.  I was thinking mine maybe better because I'm checking for more than just null arrays ?




This was voted second as  "Best Practices" but a lot of disagreements as well.

1 year ago
My apologies.  I'm not sure where or how to ask for help regarding this.  I accidentally posted in the Wiki can someone move my post to beginner ?
1 year ago
Whoops just realized this is posted in the wrong forum.  I do not see an option to delete it so I'm going to look for a way to ask for it to be moved.



I finished an exercise on codewars.com  ( https://www.codewars.com/kata/550498447451fbbd7600041c/train/java  ) and there are a lot of disagreements / discussion it seems around other people's solution.  I'm just wondering if you would please critique my solution?    One thing which was not agreed on is the Arrays.sort().   Supposedly it's not cheap ( what does that mean?) .  Is it really not a good option?

1 year ago
Okay I think I get it.  Thank you for answering each of my questions , breaking down the details.  
1 year ago

Stephan van Hulst wrote:

If there already is an entry associated with the given key, merge() will call the remapping function. The remapping function takes two arguments:

  • The existing value that is associated with the given key.
  • The new value that you passed to the merge() method.

  • The remapping function must return the value that will be associated with the key after the merge() method returns. You can use this function to quite literally merge the old and the new value.



    I have more questions about understanding the API and this merge() method.    

    I understand what is being said in this quote so I'm not asking about how to use it.   In the API it shows the BiFunction as BiFunction<? super V, ? super V, ? extends V> remappingFunction  .
    Since the remapping function takes two arguments am I correct to say the lambda is calling the BiFunction's apply() method ?

    And Questions about  <? super V, ? super V, ? extends V>  
    I want to verify what I think I understand about reading this.
    I think these are Generic types?  
    The first two are consumer types so we are giving the BiFunction something which in this case is the key and value ?  
    Is the third type ( ? extends V) representing what the BiFunction returns back?


    Last question.
    How does the Method Handles / Reference in the code example below replace BiFunction<? super V, ? super V, ? extends V> remappingFunction ?    


    It seems like the class Integer is being used now and not BiFunction?  But doesn't the Merge method require BiFunction?
    1 year ago
    I hope it's okay to share this.  Pluralsight is giving a free month for April and I recently JUST checked this out so I thought I would share.

    https://app.pluralsight.com/library/courses/setting-up-java-development-environment/table-of-contents
    1 year ago

    Junilu Lacar wrote:
    If I'm not mistaken,

    OP's:

    Hello
    Baeldung
    Readers!

    Yours:

    HELLO
    BAELDUNG
    READERS!



    You are correct.  Thank You for the explanation regarding Intellij as well.
    1 year ago