Sign in

Full-time software engineer since 2016. UCLA Computer Science B.S. with Atmospheric and Oceanic Sciences minor, class of ‘16.
Original photo by GolangMarket.

If you’re looking to append a bunch of strings together separated by a certain character or characters, then there’s an easy way in Golang to do exactly that.

What do we want to accomplish?

Let’s say you have a list of food items: pizza, pasta, sushi, pho, and tikka masala.

In Golang, that can be represented like this:

Note that we declared a slice there.

Golang’s blog describes slices as follows:

Go’s slice type provides a convenient and efficient means of working with sequences of typed data. Slices are analogous to arrays in other languages, but have some unusual properties.

Going further, a slice is…

If you work with Java’s HashMap data structure often — and you probably should be (hello, O(1) time complexity for data adds and retrievals) — then you’ll sometimes want to take advantage of the getOrDefault() method.

Understanding the method from a high level

Before we even get to the code itself and to some examples, I think it’d be helpful to understand in plain English what the function is really achieving.

Basically, you’re trying to get a certain value in the map by specifying its key (and remember that HashMap is a mapping of key(s) to value(s). …

Photo by Marten Newhall on Unsplash

This is one of the most useful keyboard shortcuts I can think of when it comes to working with IntelliJ IDEA: find in files.

What that basically means is that if you’re looking for a particular word or keyword or string or substring or number in all of your project files, you can simply use the find in files feature built into the Integrated Development Environment (IDE) and then get a list of all files that match your input as well as where exactly in the code it occurs.

To put it more concisely (and colloquially), it’s awesome.

The keyboard shortcut

No more…

When you think of immutability in Java, there are a core set of concepts that should come to mind.

In this article, I’ll enumerate some of the major points, and hopefully you’ll have a better idea of what it takes to be immutable in Java.

Immutable means its state can’t change

Immutability in Java at a high level essentially means what it does in English. In other words, something that is immutable in Java can’t change.

In Java, that means that the content or state of an immutable object simply can’t be changed. The language won’t allow it.

The class should be declared as final

The reason for this is because in Java…

If you’re looking for a basic look into what young generation, old generation, and permanent generation means in terms of Java, then you’re in the right place.

Generations? What are we talking about here?

These terms seem more fit for people than for software concepts, but read on and hopefully they’ll make more sense.

Essentially, the scope of what we’re talking about here is Java garbage collection.

Garbage collection and Java

In programming languages like C, developers have to take close care of memory by allocating and deallocating it accordingly.

Java, on the other hand, has its own automatic garbage collection with the idea that most developers don’t have to worry…

Awesome, love to hear it! Definitely is satisfying to me too for PRs. Thanks for your comment.

Original photo by Kristopher Roller on Unsplash; AdSense logo by Google

If you’re here, then you probably received the following error when you try to access a Google AdSense page:

We apologize for the inconvenience, but we are unable to process your request at this time. Our engineers have been notified of this problem and will work to resolve it.

In screenshot form, the error is the only thing you see on the page:

Original photo by Aniket Bhattacharya; logo by Pivotal; text by Tremaine Eto

Spring Boot is awesome for many reasons, and one of them is the ease of setting up external configuration so that you can run the same application code in different environments or update variables at any time without going in and having to change the code itself.

This article will go over how to achieve this in your Java application with Spring Boot using the annotations @Component and @ConfigurationProperties.

Config class declaration

First, you’ll have to create a Java class that will be a Spring Boot bean by way of the @Component annotation.

In it, the variables will be the ones that you…

Original photo by NeONBRAND on Unsplash; logo by AWS; illustration by Tremaine Eto

So you want to programmatically send emails with Amazon Simple Email Service, or SES for short.

This article concerns how to do exactly that in Java.

What is Amazon Simple Email Service?

According to Amazon, “Amazon Simple Email Service (SES) is a cost-effective, flexible, and scalable email service that enables developers to send mail from within any application. You can configure Amazon SES quickly to support several email use cases, including transactional, marketing, or mass email communications. Amazon SES’s flexible IP deployment and email authentication options help drive higher deliverability and protect sender reputation, while sending analytics measure the impact of each email. …

Photo by Tracy Adams on Unsplash

If you need to alphabetically sort a String in Java, then you’ll want to read on and memorize this order of operations.

First of all, there is no native function in Java to just take a String and then sort it.

The steps

  1. Turn the String into an array of characters (char)
  2. Sort the array of characters
  3. Create a new String using the array of characters

Examples of sorted Strings

  1. “dcba” → “abcd”
  2. “gggggc” → “cggggg”
  3. “za” → “az”

The code

So to reiterate, first we are defining a character array and then initializing it with our input string, str, that has the toCharArray() function applied to…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store