0% found this document useful (0 votes)
6 views

Beginning Kotlin: Build Applications with Better Code, Productivity, and Performance Ted Hagos pdf download

The document is a promotional material for the book 'Beginning Kotlin: Build Applications with Better Code, Productivity, and Performance' by Ted Hagos, which covers Kotlin programming concepts and application development. It includes links to various related books and resources available for download. The book aims to enhance coding skills, productivity, and performance in software development using Kotlin.

Uploaded by

aladedeljon
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Beginning Kotlin: Build Applications with Better Code, Productivity, and Performance Ted Hagos pdf download

The document is a promotional material for the book 'Beginning Kotlin: Build Applications with Better Code, Productivity, and Performance' by Ted Hagos, which covers Kotlin programming concepts and application development. It includes links to various related books and resources available for download. The book aims to enhance coding skills, productivity, and performance in software development using Kotlin.

Uploaded by

aladedeljon
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

Beginning Kotlin: Build Applications with Better

Code, Productivity, and Performance Ted Hagos


pdf download

https://ebookmass.com/product/beginning-kotlin-build-
applications-with-better-code-productivity-and-performance-ted-
hagos/

Explore and download more ebooks at ebookmass.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmass.com
to discover even more!

Frontend Development with JavaFX and Kotlin: Build State-


of-the-Art Kotlin GUI Applications Peter Späth

https://ebookmass.com/product/frontend-development-with-javafx-and-
kotlin-build-state-of-the-art-kotlin-gui-applications-peter-spath/

Programming Kotlin Applications: Building Mobile and


Server-Side Applications With Kotlin Brett Mclaughlin

https://ebookmass.com/product/programming-kotlin-applications-
building-mobile-and-server-side-applications-with-kotlin-brett-
mclaughlin/

Better Humans, Better Performance: Driving Leadership,


Teamwork, and Culture with Intentionality Peter J. Rea

https://ebookmass.com/product/better-humans-better-performance-
driving-leadership-teamwork-and-culture-with-intentionality-peter-j-
rea/

Beginning Spring Boot 3: Build Dynamic Cloud-Native Java


Applications and Microservices - Second Edition K. Siva
Prasad Reddy
https://ebookmass.com/product/beginning-spring-boot-3-build-dynamic-
cloud-native-java-applications-and-microservices-second-edition-k-
siva-prasad-reddy/
Simple and Efficient Programming with C#: Skills to Build
Applications with Visual Studio and .NET 2nd Edition
Vaskaran Sarcar
https://ebookmass.com/product/simple-and-efficient-programming-with-c-
skills-to-build-applications-with-visual-studio-and-net-2nd-edition-
vaskaran-sarcar/

Simple and Efficient Programming with C# : Skills to Build


Applications with Visual Studio and .NET 2nd Edition
Vaskaran Sarcar
https://ebookmass.com/product/simple-and-efficient-programming-with-c-
skills-to-build-applications-with-visual-studio-and-net-2nd-edition-
vaskaran-sarcar-2/

Beginning Java Objects: From Concepts to Code, 3rd edition


Jacquie Barker

https://ebookmass.com/product/beginning-java-objects-from-concepts-to-
code-3rd-edition-jacquie-barker/

Beginning Java Objects: From Concepts to Code 3rd Edition


Jacquie Barker

https://ebookmass.com/product/beginning-java-objects-from-concepts-to-
code-3rd-edition-jacquie-barker-2/

Serverless Web Applications with AWS Amplify: Build Full-


Stack Serverless Applications Using Amazon Web Services
Akshat Paul
https://ebookmass.com/product/serverless-web-applications-with-aws-
amplify-build-full-stack-serverless-applications-using-amazon-web-
services-akshat-paul/
Beginning Kotlin
Build Applications with
Better Code, Productivity,
and Performance

Ted Hagos
Beginning Kotlin: Build Applications with Better Code, Productivity,
and Performance

Ted Hagos
Makati, Philippines

ISBN-13 (pbk): 978-1-4842-8697-5 ISBN-13 (electronic): 978-1-4842-8698-2


https://doi.org/10.1007/978-1-4842-8698-2
Copyright © 2023 by Ted Hagos
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Steve Anglin
Development Editor: Laura Berendson
Coordinating Editor: Jill Balzano
Cover designed by eStudioCalamar
Cover image by Akira Hojo on Unsplash (www.unsplash.com)
Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York,
NY 10004, U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com,
or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member
(owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is
a Delaware corporation.
For information on translations, please e-mail booktranslations@springernature.com; for
reprint, paperback, or audio rights, please e-mail bookpermissions@springernature.com.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our Print
and eBook Bulk Sales web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is
available to readers on GitHub (https://github.com/Apress). For more detailed information,
please visit http://www.apress.com/source-­code.
Printed on acid-free paper
For Steph and Adrianne; and also, Wayne, Amy, plus Bagel.
Table of Contents
About the Author���������������������������������������������������������������������������������xi

About the Technical Reviewer�����������������������������������������������������������xiii

Acknowledgments������������������������������������������������������������������������������xv

Introduction��������������������������������������������������������������������������������������xvii

Chapter 1: Introduction to Kotlin����������������������������������������������������������1


About Kotlin�����������������������������������������������������������������������������������������������������������2
It’s Simple��������������������������������������������������������������������������������������������������������2
It’s Asynchronous��������������������������������������������������������������������������������������������2
It’s Object-Oriented�����������������������������������������������������������������������������������������3
It’s Functional��������������������������������������������������������������������������������������������������4
Ideal for Tests��������������������������������������������������������������������������������������������������6
Setup and Configuration of IntelliJ������������������������������������������������������������������������8
Hardware Requirements��������������������������������������������������������������������������������10
On Windows���������������������������������������������������������������������������������������������������11
On macOS������������������������������������������������������������������������������������������������������12
On Linux���������������������������������������������������������������������������������������������������������13
Getting a Project Up and Running�����������������������������������������������������������������������14
Key Takeaways����������������������������������������������������������������������������������������������������20

v
Table of Contents

Chapter 2: A Quick Tour of Kotlin��������������������������������������������������������21


Program Elements����������������������������������������������������������������������������������������������21
Literals�����������������������������������������������������������������������������������������������������������22
Variables��������������������������������������������������������������������������������������������������������22
Expressions and Statements�������������������������������������������������������������������������24
Keywords�������������������������������������������������������������������������������������������������������26
Whitespace����������������������������������������������������������������������������������������������������27
Operators�������������������������������������������������������������������������������������������������������27
Blocks������������������������������������������������������������������������������������������������������������31
Comments�����������������������������������������������������������������������������������������������������32
Basic Types���������������������������������������������������������������������������������������������������������34
Numbers and Literal Constants���������������������������������������������������������������������34
Characters�����������������������������������������������������������������������������������������������������36
Booleans��������������������������������������������������������������������������������������������������������37
Arrays������������������������������������������������������������������������������������������������������������38
Strings and String Templates������������������������������������������������������������������������39
Controlling Program Flow�����������������������������������������������������������������������������������42
Using ifs���������������������������������������������������������������������������������������������������������43
The when Statement�������������������������������������������������������������������������������������45
The while Statement�������������������������������������������������������������������������������������47
for Loops��������������������������������������������������������������������������������������������������������47
Exception Handling���������������������������������������������������������������������������������������������49
Handling Nulls�����������������������������������������������������������������������������������������������������50
Key Takeaways����������������������������������������������������������������������������������������������������53

Chapter 3: Functions��������������������������������������������������������������������������55
Declaring Functions��������������������������������������������������������������������������������������������56
Single Expression Functions�������������������������������������������������������������������������61
Default Arguments�����������������������������������������������������������������������������������������62

vi
Table of Contents

Named Parameters����������������������������������������������������������������������������������������63
Variable Number of Arguments���������������������������������������������������������������������64
Extension Functions��������������������������������������������������������������������������������������65
Infix Functions�����������������������������������������������������������������������������������������������68
Operator Overloading������������������������������������������������������������������������������������������71
Key Takeaways����������������������������������������������������������������������������������������������������74

Chapter 4: Types���������������������������������������������������������������������������������77
Interfaces������������������������������������������������������������������������������������������������������������77
Diamond Problem������������������������������������������������������������������������������������������79
Invoking Super Behavior�������������������������������������������������������������������������������81
Classes����������������������������������������������������������������������������������������������������������������83
Constructors��������������������������������������������������������������������������������������������������84
Inheritance����������������������������������������������������������������������������������������������������88
Properties������������������������������������������������������������������������������������������������������93
Data Classes�������������������������������������������������������������������������������������������������������98
Visibility Modifiers���������������������������������������������������������������������������������������������102
Inheritance Modifiers����������������������������������������������������������������������������������������104
Object Declarations�������������������������������������������������������������������������������������������105
Key Takeaways��������������������������������������������������������������������������������������������������106

Chapter 5: Higher Order Functions and Lambdas�����������������������������109


Higher Order Functions�������������������������������������������������������������������������������������109
Lambda and Anonymous Functions������������������������������������������������������������������113
Parameters in Lambda Expressions������������������������������������������������������������115
Closures�������������������������������������������������������������������������������������������������������118
with and apply��������������������������������������������������������������������������������������������������119
Key Takeaways��������������������������������������������������������������������������������������������������122

vii
Table of Contents

Chapter 6: Collections����������������������������������������������������������������������123
Arrays����������������������������������������������������������������������������������������������������������������124
Collections��������������������������������������������������������������������������������������������������������128
Lists�������������������������������������������������������������������������������������������������������������130
Sets�������������������������������������������������������������������������������������������������������������132
Maps������������������������������������������������������������������������������������������������������������133
Collections Traversal������������������������������������������������������������������������������������135
Filter and Map���������������������������������������������������������������������������������������������������137
Key Takeaways��������������������������������������������������������������������������������������������������140

Chapter 7: Generics��������������������������������������������������������������������������141
Why Generics����������������������������������������������������������������������������������������������������141
Terminologies����������������������������������������������������������������������������������������������������143
Using Generics in Functions�����������������������������������������������������������������������������144
Using Generics in Classes���������������������������������������������������������������������������������147
Variance������������������������������������������������������������������������������������������������������������149
Reified Generics������������������������������������������������������������������������������������������������154
Key Takeaways��������������������������������������������������������������������������������������������������158

Chapter 8: Debugging�����������������������������������������������������������������������159
Errors����������������������������������������������������������������������������������������������������������������159
Runtime and Logic Errors����������������������������������������������������������������������������161
Working the Debugger��������������������������������������������������������������������������������������161
Set Breakpoints�������������������������������������������������������������������������������������������164
Run the Program in Debug Mode����������������������������������������������������������������165
Analyze the Program State��������������������������������������������������������������������������166
Other Uses of the Debugger������������������������������������������������������������������������������176
Changing the Program State�����������������������������������������������������������������������177
Key Takeaways��������������������������������������������������������������������������������������������������183

viii
Table of Contents

Chapter 9: Unit Testing���������������������������������������������������������������������185


Create the First Test������������������������������������������������������������������������������������������186
Write the Test Body�������������������������������������������������������������������������������������������192
Run the Test������������������������������������������������������������������������������������������������������194
Iterate����������������������������������������������������������������������������������������������������������������195
Key Takeaways��������������������������������������������������������������������������������������������������199

Chapter 10: Writing Idiomatic Kotlin������������������������������������������������201


Null Checks and Safe Casts������������������������������������������������������������������������������202
Data Classes�����������������������������������������������������������������������������������������������������204
Named and Default Arguments�������������������������������������������������������������������������206
Named Parameters��������������������������������������������������������������������������������������206
Expressions�������������������������������������������������������������������������������������������������������208
apply( )���������������������������������������������������������������������������������������������������������������209
Extension Functions������������������������������������������������������������������������������������������209
Key Takeaways��������������������������������������������������������������������������������������������������212

Chapter 11: Creating a Spring Boot Project��������������������������������������213


Spring and Spring Boot�������������������������������������������������������������������������������������213
The Spring Family����������������������������������������������������������������������������������������214
Spring Initializr��������������������������������������������������������������������������������������������������215
Key Takeaways��������������������������������������������������������������������������������������������������224

Index�������������������������������������������������������������������������������������������������225

ix
About the Author
Ted Hagos is the CTO and Data Protection Officer of RenditionDigital
International (RDI), a software development company based out of
Dublin. Before he joined RDI, he had various software development
roles and also spent time as a trainer at IBM Advanced Career Education,
Ateneo ITI, and Asia Pacific College. He spent many years in software
development dating back to Turbo C, Clipper, dBase IV, and Visual
Basic. Eventually, he found Java and spent many years working with it.
Nowadays, he’s busy with Kotlin, full-stack JavaScript, Android, and Spring
applications.

xi
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
About the Technical Reviewer
Manuel Jordan Elera is an autodidactic
developer and researcher who enjoys learning
new technologies for his own experiments and
creating new integrations. Manuel won the
Springy Award 2013 Community Champion
and Spring Champion. In his little free time,
he reads the Bible and composes music on his
guitar. Manuel is known as dr_pompeii. He
has tech-reviewed numerous books, including
Pro Spring MVC with WebFlux (Apress, 2020),
Pro Spring Boot 2 (Apress, 2019), Rapid Java Persistence and Microservices
(Apress, 2019), Java Language Features (Apress, 2018), Spring Boot 2
Recipes (Apress, 2018), and Java APIs, Extensions and Libraries (Apress,
2018). You can read his detailed tutorials on Spring technologies and
contact him through his blog at www.manueljordanelera.blogspot.com.
You can follow Manuel on his Twitter account, @dr_pompeii.

xiii
Acknowledgments
Thanks to Steve Anglin, Mark Powers, Shonmirin, and Manuel Jordan Elera
for making this book possible.

xv
Introduction
Welcome to Beginning Kotlin.
Kotlin may have (initially) gained popularity as a drop-in replacement
for Java for building Android apps, but it’s ubiquitous now. You can use
it to build web apps—both on the front and back end. Kotlin is quickly
gaining popularity in areas that used to be Java strongholds. If you want to
get a head start on Kotlin, this book is an excellent place to start.

Chapter Overviews
Chapter 1 (Introduction to Kotlin) – Brief introduction to the Kotlin
language. You’ll learn a bit about the language's history and some of its
well-known capabilities. The chapter also walks you through the steps on
how to install Kotlin and get started with a quick project.
Chapter 2 (A Quick Tour of Kotlin) – Discusses the language
elements of Kotlin. You’ll learn the syntax with brisk examples. You’ll know
how to declare strings, variables, and constants. You’ll also learn how to
move around using Kotlin’s control structures for looping, branching, and
exception handling.
Chapter 3 (Functions) – There’s a whole chapter dedicated to
functions because Kotlin’s functions have something new up their sleeves.
It has all the trimmings of a modern language like default and named
parameters, infix functions, and operators, and with Kotlin, we can also
create extension functions. Extension functions let you add behavior to an
existing class without inheriting from it and without changing its source.

xvii
Introduction

Chapter 4 (Types) – This chapter deals with object-oriented topics.


You’ll learn how Kotlin treats interfaces, classes, and access modifiers.
We’ll also learn about the new data classes in Kotlin. It also talks about
object declarations—it’s the replacement for Java’s static keyword.
Chapter 5 (Higher Order Functions and Lambdas) – Now, we go to
Kotlins’s functional programming capabilities. It discusses how to create
and use higher order functions, lambdas, and closures.
Chapter 6 (Collections) – Walks through the classic collection classes
of Java and how to use them in Kotlin.
Chapter 7 (Generics) – Using generics in Kotlin isn’t that much
different from Java. If generics are old hat for you, then most of this chapter
will be a review. But try to read through it still because it talks about reified
generics, which Java doesn’t have.
Chapter 8 (Debugging) – Kotlin has plenty of language improvements
that help us avoid errors. Still, errors are a big part of a programmer’s life.
This chapter walks you through the steps to do a debugging session in
IntelliJ.
Chapter 9 (Unit Testing) – If you’re a fan of unit testing—why
shouldn’t you be?—this is for you. We’ll walk through the steps to write
and run unit tests using JUnit5.
Chapter 10 (Writing Idiomatic Kotlin) – Kotlin was designed to be
very similar to Java, but it also has plenty of features that make it stand out.
This chapter points out those unique Kotlin features and shows examples
of how to use them.
Chapter 11 (Creating a Spring Boot Project) – A quick introduction
to how to create a Spring Boot project using Kotlin.

xviii
Introduction

Source Code and Supplementary Material


All source code used in this book can be downloaded from github.com/
apress/beginning-kotlin, where you will also find the following online-­
only extras:
Appendix A (Java Interoperability) – You can use Kotlin classes
from Java codes and vice versa. This chapter explores Java-Kotlin
interoperability.
Appendix B (Building a Microservices App Part 1) – Spring Boot is
an excellent choice for building microservices. This appendix details how
to build a sample microservices project.
Appendix C (Building a Microservices App Part 2) – Continues from
Appendix B.
Appendix D (Cloud Deployment) – It’s the age of cloud-native apps.
This chapter discusses the workflow for bringing Spring Boot apps into
the cloud.

xix
CHAPTER 1

Introduction to Kotlin
Kotlin is a new language that targets the Java platform; its programs run on
the JVM (Java Virtual Machine), which puts it in the company of languages
like Groovy, Scala, Jython, and Clojure, to name a few.
What we’ll cover:

• Overview of the Kotlin language

• How to get Kotlin

• Getting Kotlin running in IntelliJ

Kotlin is from JetBrains, the creators of IntelliJ, PyCharm, WebStorm,


ReSharper, and other great development tools. In 2011, JetBrains unveiled
Kotlin; the following year, they open-sourced Kotlin under the Apache
2 license. At Google I/O 2017, Google announced first-class support for
Kotlin on the Android platform; since then, Kotlin’s ubiquity has spread.
You can use Kotlin for web development (server-side and/or client-side),
desktop development, and of course, mobile development. With Kotlin/
Native in the works (still in beta at the time of writing), you should soon
be able to write Kotlin codes that compile to native code that can run
without a VM. In this book, we will focus on Kotlin for server-side web
development—using Spring Boot.
If you’re wondering where the name Kotlin came from, it’s the name
of an island near St. Petersburg, where most of the Kotlin team is located.
According to Andrey Breslav of JetBrains, Kotlin was named after an island
just like Java was named after the Indonesian island of Java—however, you

© Ted Hagos 2023 1


T. Hagos, Beginning Kotlin, https://doi.org/10.1007/978-1-4842-8698-2_1
Chapter 1 Introduction to Kotlin

might remember that the history of the Java language contains references
that it was named after the coffee, rather than the island.

About Kotlin
It’s Simple
fun main() {
    val name = "stranger"        // Declare your first variable
    println("Hi, $name!")        // ...and use it!
    print("Current count:")
    for (i in 0..10) {           // Loop over a range
from 0 to 10
        print(" $i")
    }
}

As you can see from the preceding code—which I lifted from https://
kotlinlang.org—we don’t (always) have to write a class. Top-level
functions can run without wrapping them inside classes.

It’s Asynchronous
import kotlinx.coroutines.*

suspend fun main() {                                // #1


    val start = System.currentTimeMillis()
    coroutineScope {                                // #2
        for (i in 1..10) {
            launch {                                // #3
                delay(3000L - i * 300)              // #4
                log(start, "Countdown: $i")

2
Chapter 1 Introduction to Kotlin

            }
        }
    }
                                                // #5

    log(start, "Liftoff!")
}

fun log(start: Long, msg: String) {


    println("$msg " +
            "(on ${Thread.currentThread().name}) " +
            "after ${(System.currentTimeMillis() -
start)/1000F}s")
}

#1 This is a function that can be suspended and resumed later.


#2 This statement creates a scope for starting coroutines.
#3 Start ten concurrent tasks.
#4 Pause the execution.
#5 Execution continues when all coroutines in the scope have finished.

It’s Object-Oriented
abstract class Person(val name: String) {
    abstract fun greet()
}

interface FoodConsumer {
    fun eat()
    fun pay(amount: Int) = println("Delicious! Here's $amount
bucks!")
}

3
Chapter 1 Introduction to Kotlin

class RestaurantCustomer(name: String, val dish: String) :


Person(name), FoodConsumer {
    fun order() = println("$dish, please!")
    override fun eat() = println("*Eats $dish*")
    override fun greet() = println("It's me, $name.")
}

fun main() {
    val sam = RestaurantCustomer("Sam", "Mixed salad")
    sam.greet() // An implementation of an abstract function
    sam.order() // A member function
    sam.eat() // An implementation of an interface function
    sam.pay(10) // A default implementation in an interface
}

Like Java, it’s object-oriented. So, all those long hours you’ve
invested in Java’s OOP and design pattern won’t go to waste. Kotlin classes,
interfaces, and generics look and behave quite a lot like Java’s. This is
definitely a strength because, unlike other JVM languages like Scala, Kotlin
doesn’t look too foreign. It doesn’t alienate Java programmers. Instead, it
allows them to build on their strengths.

It’s Functional
Kotlin is a functional language. Higher order functions are functions that
operate on other functions, either by taking them in as parameters or by
returning them.
In a functional language (like Kotlin), functions are not just a named
collection of statements. You can use them anywhere you might use a
variable. You can pass functions as an argument to other functions, and you
can even return functions from other functions. This way, coding allows for a
different way of abstraction. Functions are treated as first-class citizens.

4
Chapter 1 Introduction to Kotlin

fun main() {
    // Who sent the most messages?
    val frequentSender = messages
        .groupBy(Message::sender)
        .maxByOrNull { (_, messages) -> messages.size }
        ?.key                                              // #1
    println(frequentSender) // [Ma]

    // Who are the senders?


    val senders = messages
        .asSequence()                                      // #2
        .filter { it.body.isNotBlank() && !it.isRead }      // #3
        .map(Message::sender)                               // #4
        .distinct()
        .sorted()
        .toList()                                          // #5
    println(senders) // [Adam, Ma]
}

data class Message(                                        // #6


    val sender: String,
    val body: String,
    val isRead: Boolean = false                           // #7
)

val messages = listOf(                                    // #8


    Message("Ma", "Hey! Where are you?"),
    Message("Adam", "Everything going according to plan
today?"),
    Message("Ma", "Please reply. I've lost you!"),
)

5
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Exploring the Variety of Random
Documents with Different Content
The Project Gutenberg eBook of Index for
Works of Willis George Emerson
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.

Title: Index for Works of Willis George Emerson

Author: Willis George Emerson

Editor: David Widger

Release date: July 19, 2018 [eBook #57541]


Most recently updated: January 25, 2021

Language: English

Credits: Produced by David Widger

*** START OF THE PROJECT GUTENBERG EBOOK INDEX FOR


WORKS OF WILLIS GEORGE EMERSON ***
INDEX FOR WORKS OF
WILLIS GEORGE EMERSON
By Willis George Emerson
With hyperlinks to all Chapters of the
Individual Ebooks
Compiled by David Widger
CONTENTS
Click on the ## before each title to go directly
to
a linked index of the detailed chapters for any
of the listed ebooks.

Click on the title to open the entire on-line


ebook.

## THE SMOKY GOD

## A VENDETTA OF THE HILLS

## BUELL HAMPTON

## MY PARDNER AND I

## THE TREASURE OF HIDDEN VALLEY

ON SOUND MONEY
TABLES OF CONTENTS OF
VOLUMES

THE SMOKY GOD


By Willis George Emerson
Contents
THE SMOKY GOD

PART ONE. AUTHOR'S FOREWORD


PART TWO. OLAF JANSEN'S STORY
PART THREE. BEYOND THE NORTH WIND
PART FOUR. IN THE UNDER WORLD
PART FIVE. AMONG THE ICE PACKS
PART SIX. CONCLUSION
PART SEVEN. AUTHOR'S AFTERWORD

A VENDETTA OF THE HILLS


By Willis George Emerson

CONTENTS
CHAPTER I—Guadalupe
CHAPTER II—Charmed Lives
CHAPTER III—Feminine Attractions
CHAPTER IV—Back to the Soil
CHAPTER V—At La Siesta
CHAPTER VI—The Quarrel
CHAPTER VII—Old Bandit Days
CHAPTER VIII—A Letter from San Quentin
CHAPTER IX—Tia Teresa
CHAPTER X—The Home of the Recluse
CHAPTER XI—A Rejected Suitor
CHAPTER XII—The Sped Bullet
CHAPTER XIII—Accused
CHAPTER XIV—Entanglements
CHAPTER XV—Behind the Bars
CHAPTER XVI—Pierre Luzon Returns
CHAPTER XVII—The Bitter Bit
CHAPTER XVIII—Elusive Riches
CHAPTER XIX—The Jail Delivery
CHAPTER XX—In the Cavern
CHAPTER XXI—A Debt of Honor
CHAPTER XXII—Underqround Wonders
CHAPTER XXIII—The Unexpected Visitor
CHAPTER XXIV—In a Tight Corner
CHAPTER XXV—Love and Revenge
CHAPTER XXVI—A Date is Fixed
CHAPTER XXVII—Among the Old Oaks
CHAPTER XXVIII—The Prize Winner
CHAPTER XXIX—-The Rendezvous
CHAPTER XXX—Don Manuel Appears
CHAPTER XXXI—Shadows of the Past
CHAPTER XXXII—Forebodings
CHAPTER XXXIII—Old Friends
CHAPTER XXXIV—Heart Searchings
CHAPTER XXXV—At Comanche Point
CHAPTER XXXVI—-Outwitted
CHAPTER XXXVII—The Dawn of Comprehension
CHAPTER XXXVIII—Exit Leach Sharkey
CHAPTER XXXIX—The Fight on the Cliff
CHAPTER XL—Revelation
CHAPTER XLI—Beneath the Precipice
CHAPTER XLII—Wedding Bells

BUELL HAMPTON
By Willis George Emerson

CONTENTS
THEME
BUELL HAMPTON
CHAPTER I.—AT LAKE GENEVA
CHAPTER II.—A CHANCE MEETING
CHAPTER III.—A DECLARATION
CHAPTER IV.—THE DEPARTURE
CHAPTER V.—A FRONTIER BANKER
CHAPTER VI.—MAJOR BUELL HAMPTON
CHAPTER VII.—THE CATTLE KING
CHAPTER VIII.—A COMMITTEE OF FIVE
CHAPTER IX.—AN AFTERNOON DRIVE
CHAPTER X.—HOME OF THE HORTONS
CHAPTER XI.—DADDY’. CONSENT
CHAPTER XII.—KANSAS PROHIBITION
CHAPTER XIII.—MAJOR HAMPTON’. LIBRARY
CHAPTER XIV.—THE SONG
CHAPTER XV.—THE RETRACTION
CHAPTER XVI.—THE OLD VIOLIN
CHAPTER XVII.—LENOX AVONDALE’. ARRIVAL
CHAPTER XVIII.—A LOVE SONG
CHAPTER XIX.—AN INVITATION TO JOIN
CHAPTER XX.—A DINNER AT THE HORTONS
CHAPTER XXI.—THE FOOT-RACE
CHAPTER XXII.—THE ELECTION
CHAPTER XXIII.—A FORGED LETTER
CHAPTER XXIV.—REVERSING THE HIGHER COURTS
CHAPTER XXV.—ALMOST A TRAGEDY
CHAPTER XXVI.—REACHING A DECISION
CHAPTER XXVII.—THE HOT WINDS
CHAPTER XXVIII.—“THY WILL BE DONE”
CHAPTER XXIX.—JACK REDFIELD ARRIVES
CHAPTER XXX.—THE QUARREL
CHAPTER XXXI.—THE PASSING OF LORD AVONDALE
CHAPTER XXXII.—THE SILENCING OF GOSSIP
CHAPTER XXXIII.—A RIDE AMONG SUNFLOWERS
CHAPTER XXXIV.—THE PRAIRIE-FIRE
CHAPTER XXXV.—A BUCKING BRONCO
CHAPTER XXXVI.—A STARTLING REVELATION
CHAPTER XXXVII.—TRYING TO REMEMBER
CHAPTER XXXVIII.—TRUTH STRANGER THAN FICTION
CHAPTER XXXIX.—JUDGE LYNN HAS AN IDEA
CHAPTER XL.—THE CATTLE THIEF CAUGHT
CHAPTER XLI.—A ROSICRUCIAN
CHAPTER XLII.—A NEW-MADE GRAVE
CHAPTER XLIII.—UNDER THE QUIET STARS

MY “PARDNER” AND I
By Willis George Emerson
1894

CONTENTS
PREFACE.
PARTIAL LIST OF ILLUSTRATIONS.
CHAPTER I.—VANCE GILDER.
CHAPTER II.—THE OLD MINER.
CHAPTER III.—THE BANNER FORCE.
CHAPTER IV—A SUPPER PARTY.
CHAPTER V.—AN ODD CHARACTER.
CHAPTER VI—THE TOWN BOOMER.
CHAPTER VII.—A VISIT TO WATERVILLE
CHAPTER VIII.—AT THE MINE
CHAPTER IX.—THE STAGE DRIVER.
CHAPTER X.—PROPERTY HAS GONE UP.
CHAPTER XI.—OWNER OF THE PEACOCK MINE.
CHAPTER XII—TROUT FISHING.
CHAPTER XIII.—THE STAGE RIDE.
CHAPTER XIV.—THE TOWN COMPANY’S MEETING.
CHAPTER XV.—MISS VIRGINIA BONIFIELD.
CHAPTER XVI.—THE OLD COLONEL’S DISAPPOINTMENT.
CHAPTER XVII.—An AWAKENING.
CHAPTER XVIII.—VANCE RETURNS TO WATERVILLE.
CHAPTER XIX.—THE INDIGNATION MEETING
CHAPTER XX.—THE STAGE IS ROBBED.
CHAPTER XXI.—REACHING THE 400 FOOT LEVEL.
CHAPTER XXII.—STARTING THE BOOM.
CHAPTER XXIII.—RUFUS GRIM S AMBITION.
CHAPTER XXIV.—THE GOLDEN MAUSOLEUM.
CHAPTER XXV.—CROSS-CUTTING IN THE MINE.
CHAPTER XXVI.—A STARTLING EDITORIAL.
CHAPTER XXVII.—AT LAST!
THE TREASURE OF HIDDEN
VALLEY
By Willis George Emerson

CONTENTS
THE TREASURE OF HIDDEN VALLEY
CHAPTER I—AT THE PARTING OF THE WAYS
CHAPTER II—A MESSAGE FROM THE GRAVE
CHAPTER III—FINANCIAL WOLVES
CHAPTER IV.—THE COLLEGE WIDOW
CHAPTER V.—WESTWARD HO!
CHAPTER VI.—RODERICK MEETS JIM RANKIN
CHAPTER VII—GETTING ACQUAINTED
CHAPTER VIII.—A PHILOSOPHER AMONG THE MOUNTAINS
CHAPTER IX—THE HIDDEN VALLEY
CHAPTER X.—THE FAIR RIDER OF THE RANGE
CHAPTER XI.—WINTER PASSES
CHAPTER XII—THE MAJOR’S FIND
CHAPTER XIV.—THE EVENING PARTY
CHAPTER XV.—BRONCHO-BUSTING
CHAPTER XVI.—THE MYSTERIOUS TOILERS OF THE NIGHT
CHAPTER XVII—A TROUT FISHING EPISODE
CHAPTER XVIII.—A COUNTRY FAIR ON THE FRONTIER
CHAPTER XIX.—A LETTER FROM THE COLLEGE WIDOW
CHAPTER XX.—THE STORE OF GOLD
CHAPTER XXI.—A WARNING
CHAPTER XXII.—THE TRAGEDY AT JACK CREEK
CHAPTER XXIII.—THE FIGHT ON THE ROAD
CHAPTER XXIV—SUMMER DAYS
CHAPTER XXV.—RUNNING FOR STATE SENATOR
CHAPTER XXVI.—UNEXPECTED POLITICAL HARMONY
CHAPTER XXVII.—THE UPLIFTING OF HUMANITY
CHAPTER XXVIII.—JUSTICE FOR THE WORKERS
CHAPTER XXIX.—SLEIGH BELLS
CHAPTER XXX.—WHITLEY ADAMS BLOWS IN
CHAPTER XXXI.—RODERICK’S DISCOVERY
CHAPTER XXXII.—STAKING THE CLAIMS
CHAPTER XXXIII—THE SNOW SLIDE
CHAPTER XXXIV—THE PASSING OF GRANT JONES
CHAPTER XXXV.—A CALL TO SAN FRANCISCO
CHAPTER XXXVI—IN THE CITY THAT NEVER SLEEPS
CHAPTER XXXVII—RODERICK RESCUES GAIL
CHAPTER XXXVIII—THE SEARCH FOR RODERICK
CHAPTER XXXIX—REUNIONS
CHAPTER XL—BUELL HAMPTON’S GOOD-BY
CHAPTER XLI.—UNDER THE BIG PINE
AFTERWORD
*** END OF THE PROJECT GUTENBERG EBOOK INDEX FOR WORKS
OF WILLIS GEORGE EMERSON ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the
United States and most other parts of the world at no
cost and with almost no restrictions whatsoever. You
may copy it, give it away or re-use it under the terms
of the Project Gutenberg License included with this
eBook or online at www.gutenberg.org. If you are not
located in the United States, you will have to check the
laws of the country where you are located before using
this eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookmasss.com

You might also like