Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Queue-Usage/PowerShell/queue-usage-1.psh
Normal file
26
Task/Queue-Usage/PowerShell/queue-usage-1.psh
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
[System.Collections.ArrayList]$queue = @()
|
||||
# isEmpty?
|
||||
if ($queue.Count -eq 0) {
|
||||
"isEmpty? result : the queue is empty"
|
||||
} else {
|
||||
"isEmpty? result : the queue is not empty"
|
||||
}
|
||||
"the queue contains : $queue"
|
||||
$queue += 1 # push
|
||||
"push result : $queue"
|
||||
$queue += 2 # push
|
||||
$queue += 3 # push
|
||||
"push result : $queue"
|
||||
|
||||
$queue.RemoveAt(0) # pop
|
||||
"pop result : $queue"
|
||||
|
||||
$queue.RemoveAt(0) # pop
|
||||
"pop result : $queue"
|
||||
|
||||
if ($queue.Count -eq 0) {
|
||||
"isEmpty? result : the queue is empty"
|
||||
} else {
|
||||
"isEmpty? result : the queue is not empty"
|
||||
}
|
||||
"the queue contains : $queue"
|
||||
3
Task/Queue-Usage/PowerShell/queue-usage-2.psh
Normal file
3
Task/Queue-Usage/PowerShell/queue-usage-2.psh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
$queue = New-Object -TypeName System.Collections.Queue
|
||||
#or
|
||||
$queue = [System.Collections.Queue] @()
|
||||
1
Task/Queue-Usage/PowerShell/queue-usage-3.psh
Normal file
1
Task/Queue-Usage/PowerShell/queue-usage-3.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
Get-Member -InputObject $queue
|
||||
1
Task/Queue-Usage/PowerShell/queue-usage-4.psh
Normal file
1
Task/Queue-Usage/PowerShell/queue-usage-4.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
1,2,3 | ForEach-Object {$queue.Enqueue($_)}
|
||||
1
Task/Queue-Usage/PowerShell/queue-usage-5.psh
Normal file
1
Task/Queue-Usage/PowerShell/queue-usage-5.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
$queue.Peek()
|
||||
1
Task/Queue-Usage/PowerShell/queue-usage-6.psh
Normal file
1
Task/Queue-Usage/PowerShell/queue-usage-6.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
$queue.Dequeue()
|
||||
1
Task/Queue-Usage/PowerShell/queue-usage-7.psh
Normal file
1
Task/Queue-Usage/PowerShell/queue-usage-7.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
$queue.Clear()
|
||||
1
Task/Queue-Usage/PowerShell/queue-usage-8.psh
Normal file
1
Task/Queue-Usage/PowerShell/queue-usage-8.psh
Normal file
|
|
@ -0,0 +1 @@
|
|||
if (-not $queue.Count) {"Queue is empty"}
|
||||
Loading…
Add table
Add a link
Reference in a new issue