Generate 100 Java Tuple classes
vim 56 54 keystrokes
iclass Tuple1 {public Object _0;}<esc>qyYp<C-a>$y2bPr,<C-a>q98@y
Since V is backwards compatible, you can Try it online!
This is the perfect task for vim! I might golf it a little bit more later. Also note that <c-a>
means Control-A, and it counts as one keystroke.
Explanation:
iclass Tuple1 {public Object _0;}<esc> 'Enter the starting text
qy 'Start recording in register y
Yp 'Yank the current line, the print on the line below
<C-a> 'Increment the next digit to occur by one
$ 'Move to the end of this line
y2b '(yank) 2 words (b)ack. This will grab '_0;'
P 'Print the previously yanked word before the cursor.
r, '(r)eplace the char under the cursor with a comma.
<c-a>q 'Increment the current digit, then stop recording
99@y 'Playback macro 'y' 99 times.
Jelly, 44 bytes
R’j“,_”
“¤>%,oỊȤʠ“ØụĊ5D³ṃṠɼQ»j;Ç;“;}¶”
ȷ2RÇ€
My first Jelly answer. Try it online!
Pyth, 53 50 48 bytes
VS100%." }SüÆðQ´Ó3Ô«%&a´4UçõÛ"[Nj",_"UN
Try it online!
Straightforward iteration over range(1,100) and building the corrosponding string from a packed string through formatting it.
Explanation
VS100%." }SüÆðQ´Ó3Ô«%&a´4UçõÛ"[Nj",_"UN VS100 # Iterate over range(1,100) %." }SüÆðQ´Ó3Ô«%&a´4UçõÛ" # Unpack the string and format it [ # List for formatting arguments N # Number of the Tuple j UN # Join Object numbers... ",_" # ...on the seperator ",_"
The unpacked string is class Tuple%i {public Object _%s;}