Java and Python both have collection types (or compound data types). For a general introduction into collection types, you might want to have a look at Wikipedia. One of the most basic collection types is a list. In Java, you use the interface java.util.List […]
Category: Coding
About coding conventions
Coding conventions are an important part of software development. Contrary to popular belief, it is not only the functionality of the code that matters, what the code does, but also the readability, what the code looks like. That is because code is read much […]
Writing shell scripts in Python
After browsing the web for some time, your download folder might be filled with a lot of files of different type. PDF files, image files and more. Or maybe you collected a lot of files in a temp folder and now you want to […]
How do I write and read plain text files in Python?
Writing and reading plain text files is easy in Python. Look at the following functions. def write_file(txt, filename): with open(filename, ‘w’) as f: f.write(txt) def read_file(filename): with open(filename, ‘r’) as f: return […]
Can I add elements to a java.util.List that is backed by an array?
It seems that you can add elements to a java.util.List that is backed by an array. For example, you could try this: import java.util.Arrays; import java.util.List; public class ListSample { public static void main(String[] args) { String[] a = {“foo”, “bar”}; List l […]